Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • arucardx Friend
    #468304

    I remember now why I failed with my workabouts. I couldn’t figure out how to remove ?tmpl=component from the url even after I managed to get the instance url into a variable. Though come to think of it… after looking at your sample code.

    Wouldn’t this simply do the trick to get the item url?
    [PHP]<?php echo $this->item->link; ?>[/PHP]

    And according to disqus’s documentation, it seems I can add this code below the identifier to make sure the thread is created with the correct url. http://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables

    <blockquote>Tells the Disqus service the URL of the current page. If undefined, Disqus will take the window.location.href. This URL is used to look up or create a thread if disqus_identifier is undefined. In addition, this URL is always saved when a thread is being created so that Disqus knows what page a thread belongs to.

    While the window.location.href is used in absence of disqus_url, we highly recommend defining this variable. If a user visits your page at the URL http://example.com/helloworld.html?123, Disqus may in fact load a different thread than if the user came from http://example.com/helloworld.html.

    To make sure the right thread is always displayed, you should define on your page, using an absolute URL, var disqus_url = ‘http://example.com/helloworld.html’;</blockquote>

    [PHP]
    var disqus_identifier = ‘<?php echo $this->item->id; ?>’;
    var disqus_url = ‘<?php echo $this->item->link; ?>’;[/PHP]

    Since the url of already created threads can’t be changed and disqus temporary disabled deletions, will need to test it on a new thread to see if it works. Only think I’m unsure is whether disqus’s facebook & twitter share will point to the correct url.

    Wall Crasher Developer
    #468306

    Hi arucardx,

    I have make some change to disqus plugin.
    Please check again you it match your idea.

    Regards

    arucardx Friend
    #468324

    Update, still doesn’t work xD. The disqus facebook & twitter share + internal links still grabs the instance’s url thus the ?tmpl=component link. Also the disqus comment box failed url verification on frame reload due to the extra ?tmpl=component in the url and thus wouldn’t load.

    I’ve been thinking over and over again the whole morning and my guess is still the problem can’t be fixed, unless the pop up frame grabs a separate template that strips everything except the article itself. Similar to the behavior of ?tmpl=component. That might work. But that would mean any modification done to item.php would need to be duplicated which… might not be plugin/update friendly thus causing more problems than good.

    So… since the “data-href” solution does work for social share buttons which resolves the issue of different share counters for pop up & direct link and shares the correct url to social websites, this opens up two scenario.

    Scenario 1 – Where “Pop Up Preview” is possibly a feasible option
    Anyone using just social share buttons in joomla/k2 articles and without any comment system. (Surprisingly, Facebook comment box works here though, since it doesn’t have any internal link to click on except to Facebook. But one would then face a APP_ID issue with Facebook like button & Facebook comment box which is where Facebook lost me as a supporter.)

    Scenario 2 – Where “Pop Up Preview” is a 100% No,No option
    Anyone looking to use k2/plugin integrated comment system or external iframe comment system. Integration may look perfect, some slight issues in getting comments to display maybe but still fixable until one uses its funky options such as the usage of http://domain.com/item#comment192 to jump directly to comment. That would cause the link to break out of the pop up since the frame url is different.

    Unless of course, the comment system uses the instance’s url which may fix the break out issue but then the url to share the comment would include ?tmpl=component thus causing link back problem. Both are unacceptable results, thus “Pop Up Preview” is a big No No option for such usage.

    ===================================================================

    Since I’m stuck in Scenario 2, and given the nature of infinite scroll & browser back button, I think my best option at this point would be to give up on “Pop Up Preview” and implement some sort of optional toggle that would automatically open articles in new tab? So my users can open articles in a new tab for reading later while they continue scrolling down the page for more content. Or simply open the article in a new tab so he don’t need to scroll from the top again later when pressing the browser back button. (Saves my server bandwidth too)

    Correct me if I’m wrong, but that’s my opinion on the current situation.

    activha Friend
    #468607

    I was wondering how to add this code to K2 without destroying the options in each category, element.

    Is there a solution to remove the tmpl from the url instead ?

    Wall Crasher Developer
    #469346

    Hi activha,

    The tmpl parameter will help to remove those content like menu or sidebar from the content. It will show a clean popup content.

    For most social media, you can use “data-href” as arucardx has describe above.

    For disqus, we are might not support it. I am not sure that the problem is from all our template. Since we have provide var disqus_url = ‘xxx’ and disqus should get the value from this parameters as it does in their comment system but in fact disqus get the url from document.referer which cause the ‘facebook’ and ‘twitter’ embed inside disqus cause problem.

    You can use other comment system like Facebook comment box.

    Regards

    activha Friend
    #471188

    Well using the code gives me a problem which is that only the main address website is retrieved in $sociallink

    If I print it I get
    [PHP]JURI Object ( [_uri:protected] => http://activ-ha.com [_scheme:protected] => http [_host:protected] => activ-ha.com [_port:protected] => [_user:protected] => [_pass:protected] => [_path:protected] => [_query:protected] => [_fragment:protected] => [_vars:protected] => Array ( ) [_errors:protected] => Array ( ) )[/PHP]

    Can you help me solve it in order to publish the url and not the website domain to the social networks ?

Viewing 6 posts - 16 through 21 (of 21 total)

This topic contains 21 replies, has 6 voices, and was last updated by  activha 12 years, 1 month ago.

We moved to new unified forum. Please post all new support queries in our New Forum