Webmastersite.net
Register Log In

Image URLs in XML feeds

Comments on Image URLs in XML feeds

webflair
Forum Regular

Usergroup: Customer
Joined: Nov 27, 2006

Total Topics: 187
Total Comments: 465
Image URLs in XML feeds
Posted Mar 21, 2013 - 7:04 PM:

I am using feeds to display extra info on one of my WSN sites.

One of the fields in the XML file is the URL of an image hosted elsewhere. When I parse the XML feed using PHP, the WSN htaccess file inserts the site URL before the Image URL.

For example if I hold the image url in a variable and the add the variable to my html like this...

<img src="<?php echo imgurl; ?>">

and lets say my website is www.url.com

I get this...

<img src="http://www.url.com/http://www.imaghostingsite.com/image.jpg">

when what I want is this...

<img src="http://www.imaghostingsite.com/image.jpg">

Any ideas how to solve this and keep WSN SEO switched on?
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Mar 26, 2013 - 7:29 PM:

If you use a template variable your img tag will work be fine. Using embedded template PHP means that the actual URL doesn't get inserted until the last possible second when it's too late for WSN to determine if it's an absolute or relative URL... so if you're going to use template PHP, just put the entire img tag inside of the PHP so that WSN doesn't try to fix the path for you:
<?php echo '<img src="'. $imgurl.'">'; ?>
webflair
Forum Regular

Usergroup: Customer
Joined: Nov 27, 2006

Total Topics: 187
Total Comments: 465
Posted Apr 13, 2013 - 4:18 PM:

Thats great, what about creating links though...

 <?php echo '<a href="'. $imgurl.'">link</a>'; ?>

Still put the site URL in front of the linked URL

Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 14, 2013 - 1:29 PM:

<?php echo '<a href="whatevertheurlisyouwanttolink"><img src="'. $imgurl.'"></a>'; ?>


I'm not sure what you want for whatevertheurlisyouwanttolink though. Which feed method are you using? Are they submitted through the submit feed page, set on the edit listing page, or WSN's template feeds (but then why are you using PHP?), or something custom?
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.