TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Replacing dynamically generated content (http://www.talkphp.com/absolute-beginners/4430-replacing-dynamically-generated-content.html)

Stahlblau 05-24-2009 02:56 PM

Replacing dynamically generated content
 
Hi.

There are some embedded videos. On a certain template file i'd like to display the videos in a different size. 300x225 -> 600x400

Here's an example where the changes have to be done:

PHP Code:

<div class="entry"

<
span class="vvqbox vvqvimeo" style="width:300px;height:225px;"><span id="vvq-35-vimeo-1"><ahref="http://www.vimeo.com/3846698">http://www.vimeo.com/3846698</a></span></span> 

<script type="text/javascript"
    
swfobject.embedSWF("http://www.vimeo.com/moogaloop.swf""vvq-35-vimeo-1""300""225""9"vvqexpressinstall, { "wmode""opaque""allowfullscreen""true""server""www.vimeo.com""clip_id""3846698""show_portrait""0""show_title""0""show_byline""0""fullscreen""1""color""FFFFFF" }, vvqparamsvvqattributes); 
</script> 

</div> 

The problem is, that everything between <div class="entry"> and </div> is allways different.

I guess the theory is like this:

1. Search between <div class="entry"> and </div> for 300 and 225
2. Replace every 300 with 600 and every 225 with 400.

I stumbled accross preg_replace and str_replace etc., read the manuals, read tons of other articles and stuff, but did not came up with a sollution. :'-(

Im absolutely new to php and only familiar with html and css.
Please help! :)

Thank you!

allworknoplay 05-24-2009 03:08 PM

Quote:

Originally Posted by Stahlblau (Post 24620)
Hi.

There are some embedded videos. On a certain template file i'd like to display the videos in a different size. 300x225 -> 600x400

Here's an example where the changes have to be done:

PHP Code:

<div class="entry"

<
span class="vvqbox vvqvimeo" style="width:300px;height:225px;"><span id="vvq-35-vimeo-1"><ahref="http://www.vimeo.com/3846698">http://www.vimeo.com/3846698</a></span></span> 

<script type="text/javascript"
    
swfobject.embedSWF("http://www.vimeo.com/moogaloop.swf""vvq-35-vimeo-1""300""225""9"vvqexpressinstall, { "wmode""opaque""allowfullscreen""true""server""www.vimeo.com""clip_id""3846698""show_portrait""0""show_title""0""show_byline""0""fullscreen""1""color""FFFFFF" }, vvqparamsvvqattributes); 
</script> 

</div> 

The problem is, that everything between <div class="entry"> and </div> is allways different.

I guess the theory is like this:

1. Search between <div class="entry"> and </div> for 300 and 225
2. Replace every 300 with 600 and every 225 with 400.

I stumbled accross preg_replace and str_replace etc., read the manuals, read tons of other articles and stuff, but did not came up with a sollution. :'-(

Im absolutely new to php and only familiar with html and css.
Please help! :)

Thank you!

Just make them variables.

width:300px;height:225px


width:${width}px;height:${height}px

Stahlblau 05-24-2009 03:19 PM

Thanks :) but i do not get it. :(

Do you mean, that i should change the code inside the div?
I can't do that since it's generated automatically, that's why i search for a way to change the values afterwards.

allworknoplay 05-24-2009 03:25 PM

Quote:

Originally Posted by Stahlblau (Post 24622)
Thanks :) but i do not get it. :(

Do you mean, that i should change the code inside the div?
I can't do that since it's generated automatically, that's why i search for a way to change the values afterwards.

Oh I see, then it sounds like you'll have to create a custom function to look for those attributes...

ReSpawN 06-01-2009 07:03 PM

How do you even know when the side should be different. If each pageload is the same or different, can't you just pass the correct size onto 2 variables and echo them there?

Else, I advise Javascript if it has to be loaded when a user performs an action.


All times are GMT. The time now is 08:37 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0