Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Facebook Like Syntax For Dynamic URL

Posted on 2011-02-22
13
677 Views
Last Modified: 2012-06-27
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.swedishmotors.com%2Fcars%2Fpages%2Fcar_search_full_details.asp%3Fid%3D<%=rsData("strcarid")%>&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=recommend&amp;font=tahoma&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

I am trying to get a facebook like link for a dymanic url - http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=582

I tried replacing the 582 with <%=rsData("strcarid")%> wihich holds the value.

If you visit the url you can see the error.

Thanks!
0
Comment
Question by:swedishmotors
  • 7
  • 6
13 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 34954907
What exactly is the problem as when clicking on the above link I don't get an error.
Show us your link code in your asp so we can try and help
0
 
LVL 1

Author Comment

by:swedishmotors
ID: 34955206
<%response.write(Server.URLEncode("http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid))%>

 <iframe src="http://www.facebook.com/plugins/like.php?href=<%response.write(Server.URLEncode("http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid))%>&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=recommend&amp;font=tahoma&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

I have update my code to URLEncode the link.
When you click the like button at the very bottom of the page, then unlike you get an error in the facebook feed.
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 34956738
You have a " that doesn't have have a matching " here : height=80" , fixing that might fix the problem

if that doesn't work try :

dim url = "http://www.facebook.com/plugins/like.php?href="http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid & "&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=recommend&amp;font=tahoma&amp;colorscheme=light&amp;height='80' scrolling='no' frameborder='0' style='border:none; overflow:hidden; width:450px; height:80px;' allowTransparency='true'"

<iframe src=<%response.write(url)%></iframe
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 1

Author Comment

by:swedishmotors
ID: 34966818
Currently I have this:

<iframe src="http://www.facebook.com/plugins/like.php?href=<%response.write("http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid )%>3E&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;font=verdana&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px; allowTransparency="true"></iframe>

Facebook Error: The page at http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=5903E could not be reached.

I do not know where the 3E is coming from? http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=590 is the link to my page.
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 34967016
You still have a " without a matching starting quote on the height attribute. colorscheme=light&amp;height=35"

I suggest you use the approach I said in my previous post
0
 
LVL 1

Author Comment

by:swedishmotors
ID: 34972579
I have tried that:

<iframe src="http://www.facebook.com/plugins/like.php?href=
<%response.write(Server.URLEncode("http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?"&(Request.QueryString)))%>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:35px; allowTransparency="true"></iframe>

I believe the problem is right here: ?"&(Request.QueryString)))%>
It is not pulling the QueryString.

0
 
LVL 1

Author Comment

by:swedishmotors
ID: 34972957
I have also tried this -
dim url
url= "http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=" & strcarid
response.write(url)


<--iframe src="http://www.facebook.com/plugins/like.php?href=<%response.write(url)%>3E&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=recommend&amp;font=verdana&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px; allowTransparency="true"></iframe>

This returns-
<--iframe src="http://www.facebook.com/plugins/like.php?href=http://www.swedishmotors.com/cars/pages/car_search_full_details.asp?id=5903E&layout=standard&show_faces=false&width=450&action=recommend&font=verdana&colorscheme=light&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px; allowTransparency="true">
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 34973009
You still don't have that quote in which is why the string is being closed after the height =35" change it to height='35'
and take out the 3E from <%response.write(url)%>3E
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 34973030
or is that where the href is supposed to end? if so maybe you just need to take out the 3E ?
0
 
LVL 1

Author Comment

by:swedishmotors
ID: 34973161
It seems the iframe now load fine - but the functionality with facebook is not working - you get an error when you click like.  It is like Facebook is not interacting with the url correctly?
0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 34973323
The error is coming back as 'The page at http://swedishmotors.com/cars/pages/car_search_full_details.asp could not be reached.', i have no idea but it does seem to be a problem at facebooks end or as you say it is not interacting with the url correctly.
0
 
LVL 1

Accepted Solution

by:
swedishmotors earned 0 total points
ID: 34974258
I found this is the only way:

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like show_faces="false" width="450" action="recommend"></fb:like>
0
 
LVL 1

Author Closing Comment

by:swedishmotors
ID: 35145526
I found the fb library is the only way to accomplish this.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question