FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.

FutureQuest, Inc.
Go Back   FutureQuest Community > General Site Owner Support (All may read/respond) > PHP, Perl, Python and/or MySQL
User Name
Password  Lost PW

Reply
 
Thread Tools Search this Thread Display Modes
Old 12-16-2009, 01:49 PM   Postid: 176826
anthony
Site Owner
 
anthony's Avatar

Forum Notability:
10 pts: User-friendly
[Post Feedback]
 
Join Date: Dec 2000
Location: Rome
Posts: 224
str_replace

Hi I got a cycling site where we are using www.openrunner.com to insert the cycling course , you can insert the course using google map.

This is an example of a course that they insert that shows up on the site.

<iframe width="700" height="400" frameborder="0" src="http://www.openrunner.com/displayRoute.php?id=404674&amp;w=650&amp;h=300&amp;k=1&amp;m=0"></iframe>

what I would like to do to have everyone inserting the same size is
to have the width="700" height="400" always at 700 and 400
and this part
displayRoute.php?id=404674&amp;w=650&amp;h=300&amp;k=1&amp;m=0
always at w=650 and h=300

I was wondering is there a way to do this with str_replace if someone inserted other values
thanks
tony
__________________
Fight MS
Ride to finish
http://www.youtube.com/watch?v=7Mj0Fgg2bt4
anthony is offline   Reply With Quote
Old 12-17-2009, 05:46 AM   Postid: 176833
Tom E.
Site Owner
 
Tom E.'s Avatar

Forum Notability:
1175 pts: A True Crowd-pleaser!
[Post Feedback]
 
Join Date: Feb 2005
Location: Connecticut
Posts: 717
Re: str_replace

Hi Anthony,

The short answer is ... you can use preg_replace to do what you need with something like this for each value you want to fix:
PHP Code:
$fragment '<iframe width="123" height="456" frameborder...';
$fragment preg_replace('/width="\d+"/''width="700"'$fragment);
$fragment preg_replace('/height="\d+"/''height="400"'$fragment);
// etc. 
Tom E. is offline   Reply With Quote
Old 12-17-2009, 05:50 AM   Postid: 176834
anthony
Site Owner
 
anthony's Avatar

Forum Notability:
10 pts: User-friendly
[Post Feedback]
 
Join Date: Dec 2000
Location: Rome
Posts: 224
Re: str_replace

thanks tom will try
tony
__________________
Fight MS
Ride to finish
http://www.youtube.com/watch?v=7Mj0Fgg2bt4
anthony is offline   Reply With Quote
Old 12-17-2009, 05:57 AM   Postid: 176835
Tom E.
Site Owner
 
Tom E.'s Avatar

Forum Notability:
1175 pts: A True Crowd-pleaser!
[Post Feedback]
 
Join Date: Feb 2005
Location: Connecticut
Posts: 717
Re: str_replace

The long answer, as usual, starts with questions...

How does the iframe get into the page? Can the user paste arbitrary code? (huge security hole, unless access is restricted to trusted people)

Is the iframe HTML by itself, like in the code example above, or do you have to find it somewhere in the entire page?

Are multiple routes allowed on a single page?

Is the island Hurley's dream?

--

It seems like the only important bit of information is the route id. Is it possible to have a form where the user just submits the id from openrunner.com, then your code creates the iframe tag?

Then if you change your site design so that 800 pixel-wide maps would look better, you just have to update the section of code that generates the iframes.

-- Tom
Tom E. is offline   Reply With Quote
Old 12-17-2009, 07:43 AM   Postid: 176836
anthony
Site Owner
 
anthony's Avatar

Forum Notability:
10 pts: User-friendly
[Post Feedback]
 
Join Date: Dec 2000
Location: Rome
Posts: 224
Re: str_replace

hi tom

the people who put in the code are in an ssl area they are teams who organize rides, on the ride oranizer can log in there. I like the idea about creating my own code with the id that could be the easiest thing to do
thanks again
tony
__________________
Fight MS
Ride to finish
http://www.youtube.com/watch?v=7Mj0Fgg2bt4
anthony is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 03:34 AM.


Running on vBulletin®
Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.
Hosted & Administrated by FutureQuest, Inc.
Images & content copyright © 1998-2013 FutureQuest, Inc.
FutureQuest, Inc.