?
Solved

Facebook Like Syntax For Dynamic URL

Posted on 2011-02-22
13
Medium Priority
?
681 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
[X]
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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

801 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