Kik.send to unique data-page - kik

I'm developing a KiK page that pulls in video content from our database and displays the items on data-page="home" of the KiK page. When you click on a particular video thumbnail, it properly takes you to the video's unique data-page. However, when sending the link to a friend with a KiK button, the link takes the friend back to the main page instead of the actual video's unique data-page so that they can watch the intended video.
Here is my current kik.send code for the button. Would I need to add in the optional 'data' field and pass something there?:
$(page).find('.kik-share').on('click', function () {
kik.send({
title: '<?php echo $row["post_title"]; ?>',
text: 'message description here',
pic: '<?php echo $row["meta_value"]; ?>',
big: true
});

You should pass the unique id of the video in the data parameter. When the receiving user loads your home page you can then check kik.message to see if a unique video id is provided. If so automatically redirect the user to the given video.

Related

How to retrieve data from different page angular

I have a button in the table in the first page. When I click on the button, I want to save the panel Id and display on the next page. How can I call the data in angular? I'm desperately seeking for help since I'm stuck in there for almost a week now.
These are the images for my problem.
enter image description here
So this one is the first page, where there are buttons in each row.
After clicking Assign, it should show readonly data of ship name and panel name.
enter image description here
Regarding your issue, you should get the panel_id from params in the URL.
E.g.
In the routing of the assigning page, you just set the path:
{
path: 'assigning/:id',
component: <YourComponent>
}
So you can get the panel_id by using ActivatedRoute.
On click event of "Assign" button, you can pass the value to the ts component. In the ts file you can pass it via URL route as a parameter to the next page or store it in localStorage and read from the next page.
<button (click)="passValue(value)">Assign</button>

Preview the uploaded pictures in antd

I have implemented a PicturesWall component in my app similar to this one on the antd site: https://ant.design/components/upload/#components-upload-demo-picture-card. When the user uploads images, thumbnails are generated and the user can preview and delete them. Now, this is when I create the item, but I implement an edit functionality where I have the input text fields populated with what the user entered when he created the item. How do I list the images the user uploaded when he created the item?
While editing, you need to update the state of fileList and previewImage similar to the initial state as given below:
this.setState({
fileList:[{uid:-1,status: 'done',url:'your image Url'}],
previewImage: 'your image Url',
});
You can do this by checking if you are getting the image data to be edited.

Drupal 7, how to add text to the user profile page

I need to add a paragraph of text near the top of the user profile page found at /user, this is page you are initially taken to after login.
I'm not fluent with Drupal, and I can't find any answers online.
Could any advise how I can add text to the user profile page?
you can also add a block to the "content area" to be shown below the user profile (restricted to user/* pages). In the block you an use short PHP snippets.
In a custom Drupal module you could use hook_form_FORM_ID_alter(), this will let you change the user profile form, where you could attach a div element that will hold the paragraph text you wish to insert to the page. You will also give weight to your div, so that it is displayed on top of the form.
Here is a code snippet:
function custommodulename_form_user_profile_form_alter() {
$description_html = '<div>Lorem ipsum...</div>';
$form['description'] = array(
'#markup' => $description_html,
'#weight' => -10,
);
}

Sending data for conditional check across Chronoform V5 multipage form for Joomla CMS

I am using Chronoform V5 for my Joomla site. I have created a Multi Page form wherein a user will fill in each page and click next to proceed and at the end the form will be finally submitted and some results will be displayed based on the input. This part works fine.
Now I have a dropdown in first page. If a user selects e.g, option 'a' and clicks 'next page' button i want to hide a dropdown in the second page. In case the user selects option 'b' in the first page this dropdown in second page should be visible.
Any idea how to achieve this?
I would use a Custom code action to check the submitted value and use CSS to show or hide the value:
<?php
$display = 'block';
if ( $form->data['var_name'] == 'xxx' ) {
$display = 'none';
}
$style = "#some_id { display: '{$display}'; }";
$jdoc = \JFactory::getDocument();
$jdoc->addStyleDeclaration($style);
?>

Full Page Cache in CakePHP

I have one search page with some search criteria. From that page I going to some other page and clicking browser back button means the page was refreshing. Actually I page should not be refresh instead on refreshing the page should display with some result with out refreshing.
Kindly give me suggestions.
From you question i understand that you need navigate to some other page without refreshing the page as like google.
But its not done using cache. There are function called pushState() and onpopstate() to make this.
How it will work?
With the function pushState(), we can able to change the url of a page without refreshing the page. And the previous url will automatically added to the history. So we need implement a single page to load the content of the page using ajax based on the url.
The function onpopstate() will be triggered when a url is changed using pushState().
Example:
http://html5.gingerhost.com/
The above page uses the above function. That page consist of 4 links (Home, Seattle, New York, London). When we click on those link a new url will be loaded without refreshing the page.
<title></title>
<ul id="menu" class="clearfix">
<li class="current">Home</li>
<li>Seattle</li>
<li>New York</li>
<li>London</li>
</ul>
<article>
<h1></h1>
<div id="image"></div>
<div id="articletext"></div>
<div class="clear"></div>
</article>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script>
// THIS IS WHERE THE MAGIC HAPPENS
$(function() {
//Capture the click on the links
$('#menu a').click(function(e) {
href = $(this).attr("href");
// Call a function to load the content based on the url
loadContent(href);
// HISTORY.PUSHSTATE add the url to the history
history.pushState('', 'New URL: '+href, href);
e.preventDefault();
});
// THIS EVENT MAKES SURE THAT THE BACK/FORWARD BUTTONS WORK AS WELL
window.onpopstate = function(event) {
console.log("pathname: "+location.pathname);
// Load the content on clicking back or forward using its url
loadContent(location.pathname);
};
});
function loadContent(url){
// USES JQUERY TO LOAD THE CONTENT PROVIDED BY content.php
$.getJSON("content.php", {cid: url, format: 'json'}, function(json) {
// output provider by content.php like {"title":"Seattle - Part of a demo for #ProSEO","h1":"Seattle","article #articletext":"<p>Seattle is the northernmost major city in the contiguous United States, and the largest city in the Pacific Northwest and the state of Washington. It is a major seaport situated on a narrow isthmus between Puget Sound (an arm of the Pacific Ocean) and Lake Washington, about 114 miles (183 km) south of the Canada - United States border, and it is named after Chief Sealth \"Seattle\", of the Duwamish and Suquamish native tribes. Seattle is the center of the Seattle-Tacoma-Bellevue metropolitan statistical area--the 15th largest metropolitan area in the United States, and the largest in the northwestern United States.<\/p><p>Seattle is the county seat of King County and is the major economic, cultural and educational center in the region. The 2010 census found that Seattle is home to 608,660 residents within a metropolitan area of some 3.4 million inhabitants. The Port of Seattle, which also operates Seattle-Tacoma International Airport, is a major gateway for trade with Asia and cruises to Alaska, and is the 8th largest port in the United States in terms of container capacity.<\/p>","#image":"<img class=\"thumbnail\" alt=\"\" src=\"seattle.jpg\">"}
// THIS LOOP PUTS ALL THE CONTENT INTO THE RIGHT PLACES(values will be set)
$.each(json, function(key, value){
$(key).html(value);
});
});
}
</script>
As like above you can able to render the content and provide a json response and pass it to the jquery and you can able to achieve that.
Some suggestions:
Use session to store search parameters, when user back to search page check if session exist. If exist use that parameters to find data again or load cached query results.
Better options, change form request type from POST to GET method. So when you submit search form, your url looks like:
http://myhost.com/search?q=my+term&param1=zzz&param2=&param3=
Use this url parameters to find data again. This option allow you to share search criteria with other users.
Create the search values to create a unique key e.g. with md5. Then store the result with this key to your caching system ( file, memcached whatever).
So if a user should run the same search again fetch the result directly from cache without bothering the db.
It could look like this:
$sCacheKey = md5(json_encode($this->data));
$result = Cache::read($sCacheKey, 'short');
if ($result === false) {
$result = $this->YourModel->find(conditions etc....);
Cache::write($sCacheKey, $li, 'short');
}
Or do you want to cache your complete rendered page?

Resources