This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Social Icons display
#1

I would like to be able to have the social icons displayed whether there are comments or not on the page. Is it possible to do this? I have tried copying the block of code to the "no comments" section in comments.php. That displays the icons ok but when clicking on one of them (Facebook, for example), the Url is incomplete and I just get a blank page displayed in my browser.

Commentics integrates so well into my site that I would like to utilise the social icons no matter whether there are any comments posted or not.

Any help to achieve this would be hugely appreciated this.

Cheers
Roger
Reply
#2

Hi,

Can you paste here the code that you copied?

Also, you'll need to make sure that the page exists in Commentics for this to work. To do this, in the admin panel go to 'Manage -> Pages', click the 'Options' link at the top right, and uncheck "Don't create the page until the user posts".

A link to your website would also help.

Have you completed the interview?
Reply
#3

(28-Feb-2014, 09:01 PM)Steven Wrote:  Hi,

Can you paste here the code that you copied?

Apologies for the delay in replying. I have cancer, the treatment for which takes up a lot of my time!). Anyway, I'm not a programmer (my website works despite my best efforts, not because of them!).

Here is the address of a page that includes comments (near the bottom of the page) ...

http://mfo.me.uk/getperson.php?personID=I1&tree=E1

... and here is one that doesn't...

http://mfo.me.uk/getperson.php?personID=I3&tree=E1

The code that I copied (and please remember that I really don't know what I'm doing) is the following:

Code:
/* *** Social *** */
    echo "<div class='cmtx_social_block'>";
    if (cmtx_setting('show_social')) {

    $cmtx_social_url = cmtx_url_encode_spaces(cmtx_get_page_url());
    $cmtx_social_title = cmtx_url_encode_spaces(cmtx_get_page_reference());

    $cmtx_social_url = str_ireplace("&amp;", "%26", $cmtx_social_url); //convert &amp; to %26
    $cmtx_social_title = str_ireplace("&amp;", "%26", $cmtx_social_title); //convert &amp; to %26

    $cmtx_social_attribute = ""; //initialize variable

    if (cmtx_setting('social_new_window')) {
        $cmtx_social_attribute = " target='_blank'";
    }

    echo "<div class='cmtx_social_images'>";

    if (cmtx_setting('show_social_facebook')) {
        echo "<a href='http://www.facebook.com/sharer.php?u=" . $cmtx_social_url . "&amp;t=" . $cmtx_social_title . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/facebook.png' class='cmtx_social_image' title='Facebook' alt='Facebook'/></a>";
    }
    if (cmtx_setting('show_social_delicious')) {
        echo "<a href='http://delicious.com/post?url=" . $cmtx_social_url . "&amp;title=" . $cmtx_social_title . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/delicious.png' class='cmtx_social_image' title='del.icio.us' alt='del.icio.us'/></a>";
    }
    if (cmtx_setting('show_social_stumbleupon')) {
        echo "<a href='http://www.stumbleupon.com/submit?url=" . $cmtx_social_url . "&amp;title=" . $cmtx_social_title . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/stumbleupon.png' class='cmtx_social_image' title='StumbleUpon' alt='StumbleUpon'/></a>";
    }
    if (cmtx_setting('show_social_digg')) {
        echo "<a href='http://digg.com/submit?phase=2&amp;url=" . $cmtx_social_url . "&amp;title=" . $cmtx_social_title . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/digg.png' class='cmtx_social_image' title='Digg' alt='Digg'/></a>";
    }
    if (cmtx_setting('show_social_technorati')) {
        echo "<a href='http://technorati.com/faves?add=" . $cmtx_social_url . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/technorati.png' class='cmtx_social_image' title='Technorati' alt='Technorati'/></a>";
    }
    if (cmtx_setting('show_social_google')) {
        echo "<a href='https://plus.google.com/share?url=" . $cmtx_social_url . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/google.png' class='cmtx_social_image' title='Google+' alt='Google+'/></a>";
    }
    if (cmtx_setting('show_social_reddit')) {
        echo "<a href='http://reddit.com/submit?url=" . $cmtx_social_url . "&amp;title=" . $cmtx_social_title . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/reddit.png' class='cmtx_social_image' title='Reddit' alt='Reddit'/></a>";
    }
    if (cmtx_setting('show_social_myspace')) {
        echo "<a href='http://www.myspace.com/Modules/PostTo/Pages/?u=" . $cmtx_social_url . "&amp;t=" . $cmtx_social_title . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/myspace.png' class='cmtx_social_image' title='MySpace' alt='MySpace'/></a>";
    }
    if (cmtx_setting('show_social_twitter')) {
        echo "<a href='http://twitter.com/home?status=" . $cmtx_social_title . "%20-%20" . $cmtx_social_url . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/twitter.png' class='cmtx_social_image' title='Twitter' alt='Twitter'/></a>";
    }
    if (cmtx_setting('show_social_linkedin')) {
        echo "<a href='http://www.linkedin.com/shareArticle?mini=true&amp;url=" . $cmtx_social_url . "&amp;title=" . $cmtx_social_title . "' rel='nofollow'$cmtx_social_attribute><img src='" . cmtx_comments_folder() . "images/social/linkedin.png' class='cmtx_social_image' title='LinkedIn' alt='LinkedIn'/></a>";
    }

    echo "</div>";
    }
    echo "</div>";



    echo "<div style='clear: both;'></div>";

I dropped this in after line 325 following this line...

Code:
if ($cmtx_number_of_comments == 0) { //if no comments

It now seems to work but I'd certainly appreciate it is you would take a look at make sure I havent done something that I might regret later Angel. This really is beyond my capabilities so thanks in advance for any thoughts you might have. If you say it's too difficult, that's good enough for me.

(PS., I've attached a copy of the file as it is modified by me.)

Thanks
Roger


Attached Files
.php comments.php Size: 29.46 KB  Downloads: 17
Reply
#4

Hi Roger,

The code you've posted looks fine and it appears to be working and looking good on your website.

Well done Smile

Have you completed the interview?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post

Forum Jump:


Users browsing this thread: 1 Guest(s)