Facebook feed dialog deprecating custom fields - ajax

Facebook Feed Dialog 2.9 has deprecated the custom fields (name, caption, picture, description) - https://developers.facebook.com/docs/sharing/reference/feed-dialog.
I'm working on an AJAX site where all content and metadata is loaded dynamically. If I just use the link property, the metadata isn't set on initial retrieval of the page so the post doesn't contain the right content.
How can I share an AJAX page on Facebook without having to go down the route of prerendering static pages server side? Thanks

If you can program your page to populate the appropriate metatags on the page load based off of a variable http:/yoursite.com/yourpage.php?thisversion=1 then when you want to share version 1 of the page, you just share the URL with the appropriate variable to populate it. You can still remain on your current version of the page but when you share the URL that would prompt that specific version, facebook makes a call to that respective URL and pulls the appropriate metatags that would be populated by your variable without having to reload the page your are currently displaying. Sorry I don't have time at the moment but will try and comeback and add some sample code for clarity.

Related

Does a pages URL change with AJAX?

I'm taking an online course from a site that does not provide for asking questions about the content, so I am asking you.
This is one of the MUSTS for page titles:
"On a so-called single-page application — in which AJAX is used to bring in new content without refreshing or loading the entire web page — any time that the URL changes, the page title should be updated accordingly"
I always thought that if you used ajax to change part of a page the page itself would remain static. That is why would a URL change with an AJAX call. Are there any examples showing what this looks like?
AJAX requests don’t change the browser URL or history. To mimic the behaviour of traditional websites, single page apps will modify the URL and history and use the URL to change the view.
For more on changing the browser history, see Adding and modifying History entries.

Custom title and image for Facebook share button on AJAX result

This question exists in different flavors, but not for AJAX pages.
I use AJAX to pull a single video into my page and I want a custom FB share button for it. Everything I've read so far says that FB pulls the required title and image from meta-tags in the page's < head> section (og:image and og:title).
I've tried to change the meta properties when the AJAX call returns, before rendering the share button. This hasn't worked. It uses the values that were present upon initial page load. I have yet to encounter a single answer to this question.
Are there data attributes I can add to the 'fb-like' div to specify a custom title and image (similar to data-href)?
Danke!
You need an individual URL for each individual piece of content that you want to share. Open Graph objects (and simple shared links “become” such, automatically) are identified by their URL (og:url).
Now if your whole page is built on AJAX, you still need to create such individual URLs somehow – the Facebook scraper tool does not “speak” JavaScript, and relies solely on the OG meta information that the server delivers for any URL it requests.
Since the hash part of an URL is only of relevance client-side (and does not even get send to the server), “typical” AJAX URLs that rely on those to tell the client which piece of content to load in the background are no good here.
So if you want to share two pieces of content (videos) as http://www.example.com/?v=vid1 and http://www.example.com/?v=vid2, then you have to make sure that your server delivers the meta data for each video under its respective URL.

Joomla component - how to convert standard php form into joomla component

Currently i have been using an iframe component to display a php page that i have written. the reason i used iframe rather than writing a joomla component in the first place was for 2 reasons, the information that is displayed in that page is from a remote mssql sever and the second was that i didnt really understand how to write one.
Now i have completed the creation of the php page that i display within the iframe, but now i need to be able to have it inherent within the joomla site, for both display reasons and security.
basically its a single page that displays information in a bunch of drop down boxes and then a submit button is clicked and it posts that information to another php page that again queries the mssql server and displays the results based on the post from the previous page.
query.php, posts some variables to results.php and is displayed in a table.
i have the functionality perfect, but i dont understand the documentation i have read so far. is there any simple component i can see the code of so that i can try and work out whats going on?
You might want to look at http://docs.joomla.org/J3.1:Developing_a_MVC_Component/Introduction and follow the process outlined.

Alfresco share page state history

How can I manage page state history in share (surf?) so that I remember for example which yui tab was active and on which page the pager was on?
I noticed that alfresco share does something like that after form submit. You get redirected to the exact same page url where you were before. If any "ajax state" (don't know what they are called) parameters are in url like #something=asdf you get the same url.
But when using manual navigation like moving through site pages those parameters aren't saved.
Is this even a good idea to do? To save page state in session for example?
Some pages have support for URL parameters that are passed in. In those cases the browser history is used, e.g. we editing metadata in the full page meta data view the user is send back to the page he is coming from. This is done in javascript by calling window.history.go(-1) after form submit but only works when parameters are set/retrieved by URL. The document library implements page specific javascript for setting the URL and parsing parameters from it.
I some places Alfresco uses the preference service to store user settings between different pages permanently. For example this is used in the document library for the "show folders" and "simple/thumbnail view" buttons. Here is some sample code from the document library javascript setting a preference option:
var PREFERENCES_DOCLIST = "org.alfresco.share.documentList",
PREF_SHOW_FOLDERS = PREFERENCES_DOCLIST + ".showFolders";
var preferences = new Alfresco.service.Preferences();
this.services.preferences.set(PREF_SHOW_FOLDERS, true);
The evaluation of the properties is usually done in the Share component webscripts, you can have a look in share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\documentlibrary\include\documentlist.lib.js for an example.
In any case you have to dig into Alfresco's javascript code in the browser and the share tier to see how to implement it.
You could check parameters sended to the server side after form submiting in the firebug (firefox plugin) and then you could use the same parameters.
Also perhaps you should use yui history manager:

Virtuemart Display Page after Remote redirect

I am aiming to create a payment module. Its users shall be redirected away from the site's URL in order for the transaction to be processed by a third party at a different URL. I would then like customers to be redirected back to a generic 'success' page that notifies them the order was a success. I have tried redirecting to the default success page (checkout.thankyou.php), but I get lots of errors; all the constants etc. that the application requires have obviously been lost during the redirect.
I would like to be able to retrieve the theme currently enabled in the configuration and use it to insert some basic HTML into the view. I would also like to access the database to perform some queries.
Can anybody advise? I am very stuck, and cannot find anything useful in the documentation! Thank you.
Can you be more specific about what type of information you want in your success page? If you just want basic HTML, then there's no reason you can't just write a basic Joomla article and redirect to that instead of trying to redirect to a VM partial. Again, if it's just basic HTML (no data from the transaction), then you can simply use a code inspector (like FireFox Inspect Element) to track down the CSS classes you like from the template and simply use them in your Joomla article to make it look like the VM template. You can find most of them in components/com_virtuemart/themes/default/themes.css.
If you need to display actual transaction data in your Thank You message, be prepared for a bit more work. You're probably going to have to write a cookie containing the record data BEFORE it gets sent offsite, and then read the cookie just prior to rendering the Thank You page.

Resources