Jump to content

Facebook like button built with PHP


needphphelp22

Recommended Posts

Hello I am using joomla with sobi2.

 

im working in the sobi2 details template. I am having some difficulties with the like button. maybe i'm going about it all wrong but ill show you what i got and hopefully you can lend me some advise.

 

This works

 

      <?php echo '<p><iframe src="http://www.facebook.com/plugins/like.php?href='; ?>

      <?php echo 'www.google.com'; ?>

      <?php echo '&layout=standard&show_faces=false&width=450&action=like&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe></p>'; ?>

 

output

----

(working like button)

----

 

this works

 

      <?php $testv='www.google.com' ?>

      <?php echo $testv ?>   

      <?php echo '<p><iframe src="http://www.facebook.com/plugins/like.php?href='; ?>

      <?php echo $testv; ?>

      <?php echo '&layout=standard&show_faces=false&width=450&action=like&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe></p>'; ?>

 

output

------

www.google.com

(working like button)

-------

 

This doesn't work

 

      <?php $testv=$fieldsFormatted['field_street']; ?>

      <?php echo $testv ?>   

      <?php echo '<p><iframe src="http://www.facebook.com/plugins/like.php?href='; ?>

      <?php echo $testv; ?>

      <?php echo '&layout=standard&show_faces=false&width=450&action=like&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe></p>'; ?>

 

 

output

-------

www.google.com

(not working like button)

--------

facebook gives me an error "The page at http://<span%20%20id=/ could not be reached."

 

Link to comment
Share on other sites

good tip.  in the source its not comming out right. i get

 

<span  id="sobi2Details_field_street">www.google.com</span>   

      <p><iframe src="http://www.facebook.com/plugins/like.php?href=     

<span  id="sobi2Details_field_street">www.google.com</span>      &layout=standard&show_faces=false&width=450&action=like&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe></p>

 

so in guessing the value is <span  id="sobi2Details_field_street">www.google.com</span>

 

i need to remove the <span  id="sobi2Details_field_street"> and </span>. the url is always going to be differnet lengths. any idea on the best way to fix the var?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.