Irish SEO,  Marketing & Webmaster Discussion

 

Adding to a string in PHP????

This is a discussion on Adding to a string in PHP???? within the Coding Help forums, part of the Webmaster Discussion category; I have the below code and want to add '../' just before the link, how can i do this, i've ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Webmaster Discussion > Coding Help

Register Forum Rules FAQDonate Calendar Search Today's Posts Mark Forums Read



Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 28-09-2007, 05:55 PM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 461
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Thanks: 3
Thanked 0 Times in 0 Posts
ziycon will become famous soon enough
Send a message via MSN to ziycon
Default Adding to a string in PHP????

I have the below code and want to add '../' just before the link, how can i do this, i've tried string replace but no luck!??
The whole link is in a string before being saved to the DB.

What i have:
Code:
<img src="images/image1.jpg"/>
What i want:
Code:
<img src="../images/image1.jpg"/>
__________________
Irish Gaming Network
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 28-09-2007, 06:15 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,328
Nominated 7 Times in 5 Posts
Nominated TOTW/F/M Award(s): 2
Thanks: 0
Thanked 1 Time in 1 Post
louie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enough
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

did you try:
PHP Code:
$str str_replace('<img src="images','<img src="../images',$str); 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 28-09-2007, 06:30 PM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 461
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Thanks: 3
Thanked 0 Times in 0 Posts
ziycon will become famous soon enough
Send a message via MSN to ziycon
Default

Quote:
Originally Posted by louie View Post
did you try:
PHP Code:
$str str_replace('<img src="images','<img src="../images',$str); 
Nope didn't work! There is text and code before and after this line if that makes any difference??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 28-09-2007, 07:00 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,328
Nominated 7 Times in 5 Posts
Nominated TOTW/F/M Award(s): 2
Thanks: 0
Thanked 1 Time in 1 Post
louie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enough
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

it shouldn't as str_replace is very good at doing this kind of job.

show us the code, you are probably missing something.
__________________
:. Web Design & Development Web Design Ireland
:. Search Engines Optimization Search Engines Optimization
:. Car Parts & Accessories Car Parts
:. Cars Ireland Cars Ireland
:. I Have 2 Find It Directory SEF Directory
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 28-09-2007, 07:01 PM
ziycon's Avatar
Wannabe Geek
 
Join Date: Jan 2007
Location: Dublin
Posts: 461
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Thanks: 3
Thanked 0 Times in 0 Posts
ziycon will become famous soon enough
Send a message via MSN to ziycon
Default

I got it, the code i was using and the code you game me was fine, i just had 2 characters reversed in a variable name!
I feel so stupid!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 28-09-2007, 07:13 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 2,328
Nominated 7 Times in 5 Posts
Nominated TOTW/F/M Award(s): 2
Thanks: 0
Thanked 1 Time in 1 Post
louie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enoughlouie will become famous soon enough
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

lol. take a break.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
adding, php, string

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
PHP, OOPS! data typing Mike Coding Help 2 24-08-2007 02:44 PM
PHP mySQL Problem!? ziycon Server / Technical Administration Tips and Queries 1 15-07-2007 08:31 PM
Simple PHP Breadcrumb Script? ButtermilkJack Coding Help 4 17-03-2007 06:50 PM
PHP string infected with weird characters. littleBird Coding Help 5 10-03-2007 09:19 AM
WTF - Some PHP Obfuscation. daviddoran General Chat 8 20-02-2007 05:45 PM


Sponsored links

Pepperjam Network
Paid On Results www.zanox.com Get Chitika Premium


All times are GMT +1. The time now is 12:38 PM.


Powered by: vBulletin Version 3.8.4, Copyright ©2000 - 2010, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64