Jump to content

ozzy47

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ozzy47's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ozzy47

    str_replace

    I have tried: $vbulletin->templatecache['postbit_legacy'] = str_replace('<div class="postbody">','<div class="postbody <vb:if condition="$show['moderated']">moderated</vb:if>">".>',$vbulletin->templatecache['postbit_legacy']); Which shows a syntax error in php, unexpected T_STRING I tried this: $vbulletin->templatecache['postbit_legacy'] = str_replace('<div class="postbody">','<div class="postbody <vb:if condition="$show[\'moderated\']">moderated</vb:if>">".>',$vbulletin->templatecache['postbit_legacy']); Which does not work it shows errors on my page, Parse error: syntax error, unexpected T_STRING
  2. ozzy47

    str_replace

    I am trying to code a str_replace but I can not get it to work. This is what I am searching for: <div class="postbody"> And this is what I need it replaced with: <div class="postbody <vb:if condition="$show['moderated']">moderated</vb:if>"> This is how I have to write the str_replace for vbulletin: $vbulletin->templatecache['postbit_legacy'] = str_replace('SEARCH CODE','REPLACE CODE',$vbulletin->templatecache['postbit_legacy']);
  3. Please be easy with me as I am new to this, so I will try to explain as best as I can. In my php file I have used this: $vbulletin->templatecache['navbar']= preg_replace( $search[1] = '#(<li>|<li\s*class="selected">)*<a\s*class="navtab"\s*href="search\.php\?\'\s*\.\s*\$session\[\'sessionurl\'\]\s*\.\s*\'do=\w+&contenttype=\w+"\s*accesskey="\d">\'\s*\.\s*vB_Template_Runtime::parsePhrase\("\w*"\)\s*\.\s*\'</a>(</li>)*#i','',$vbulletin->templatecache['navbar']); Which searches my output for these html codes: <li class="selected"><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a> <li class="selected"><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getdaily&contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a> <li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a></li> <li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getdaily&contenttype=vBForum_Post" accesskey="2">{vb:rawphrase getnew_tab}</a></li> What that does is hide those four lines and works as intended. Now what I want to do is with another option, search for those four codes, and have the output look like this: <li class="selected"><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&contenttype=vBForum_Post" accesskey="2"><img src="dbtech/vbnavtabs/images/whats_new_image/whats_new.png" style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >{vb:rawphrase getnew_tab}</a> <li class="selected"><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getdaily&contenttype=vBForum_Post" accesskey="2"><img src="dbtech/vbnavtabs/images/whats_new_image/whats_new.png" style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >{vb:rawphrase getnew_tab}</a> <li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&contenttype=vBForum_Post" accesskey="2"><img src="dbtech/vbnavtabs/images/whats_new_image/whats_new.png" style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >{vb:rawphrase getnew_tab}</a></li> <li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getdaily&contenttype=vBForum_Post" accesskey="2"><img src="dbtech/vbnavtabs/images/whats_new_image/whats_new.png" style="margin-bottom:.25em; vertical-align:middle;' . $image_padding . '" >{vb:rawphrase getnew_tab}</a></li> I have tried numerous ways, but can not get it to function, if someone could tell me the code I need to use as I am at a loss. Any help would be greatly appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.