MrNoob Posted August 21, 2009 Share Posted August 21, 2009 Hey PHPFreaks, help requied Site: http://www.blametruthproject.com/home I post a lot of flash videos on my site and they are being forced to the front, so my drop down menus go in behind them which is not exactly ideal. So I found out I can use wmode="transparent" to fix this so I was wondering if someone could take a look at my source and tell me how to implement str_replace, so far I have this This is the code I want to be replaced: <embed src="[url OF FLASH]" type="application/x-shockwave-flash" width="480" height="360" allowscriptaccess="always" allowfullscreen="true"> And using str_replace I have: $subject='type="application/x-shockwave-flash" width="480"'; $search='type="application/x-shockwave-flash" '; $replace='type="application/x-shockwave-flash" wmode="transparent" '; $new_value=str_replace($search,$replace,$subject); So would any of you fine upstanding gentleman care to help a complete PHP noob to implement this into a Wordpress theme? Cheers, MrNoob Link to comment https://forums.phpfreaks.com/topic/171277-str_replace-help/ Share on other sites More sharing options...
trq Posted August 21, 2009 Share Posted August 21, 2009 Can you explain what your trying to do? Why do you need to do this using php? Link to comment https://forums.phpfreaks.com/topic/171277-str_replace-help/#findComment-903272 Share on other sites More sharing options...
MrNoob Posted August 21, 2009 Author Share Posted August 21, 2009 Ah yes, well I post almost exclusively flash videos and I already have quite a lot posted and I will be posting a LOT more in the future. The problem is flash videos are the top most thing and I have drop down menus on my site so when I rollover Videos all the dropdown content is hidden by the flash videos. So instead of manually adding wmode="transparent" into every single <object></object> I'm looking for this str_replace to insert the wmode between type="" and width="" If you need any more info please ask, your help is appreciated. Or if anyone knows any other method to set all flash content on my site to wmode="transparent" that would be appreciated too. Link to comment https://forums.phpfreaks.com/topic/171277-str_replace-help/#findComment-903290 Share on other sites More sharing options...
thebadbad Posted August 21, 2009 Share Posted August 21, 2009 Do you add your videos via a Wordpress plugin of some sort, or do you manually type in the HTML? I'm not too familiar with Wordpress, but if you use a plugin you should be able to change the source code of it somewhere, so it includes the wmode automatically (for new videos, that is). Link to comment https://forums.phpfreaks.com/topic/171277-str_replace-help/#findComment-903294 Share on other sites More sharing options...
MrNoob Posted August 21, 2009 Author Share Posted August 21, 2009 Do you add your videos via a Wordpress plugin of some sort, or do you manually type in the HTML? I'm not too familiar with Wordpress, but if you use a plugin you should be able to change the source code of it somewhere, so it includes the wmode automatically (for new videos, that is). No I add the embed code manually for each new post, the code comes from a default 'Embed this video' from blip.tv or youtube.com Link to comment https://forums.phpfreaks.com/topic/171277-str_replace-help/#findComment-903331 Share on other sites More sharing options...
thebadbad Posted August 21, 2009 Share Posted August 21, 2009 Okay then. You can use regular expressions to add the attribute: $str = preg_replace('~<object\b~i', '<object wmode="transparent"', $str); Link to comment https://forums.phpfreaks.com/topic/171277-str_replace-help/#findComment-903380 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.