Solved

Facebook Like Syntax For Dynamic URL

Posted on 2011-02-22
13
674 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

930 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now