Jump to content

Heyes

New Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Heyes

  1. As an example, my page html contains <?php echo $frm['elements']['product_id_page-0-0']['htmle'] ?> from a third-party membership app. The code adds br tags which I don't want. By using <?php echo str_replace('<br />', '', $frm['elements']['product_id_page-0-0']['htmle']) ?>, those br tags are removed without the need to modify the core code. There are several instances of similar code in a page, and I add the str_replace to each. When I originally posted my question, I'd mistakenly thought that I could add one str_replace to the whole page and have all br tags removed. I now realise that str_replace has to be added to each element to be modified.
  2. Thanks. Part of the page is generated by a third-party app - similar to how, for example, Disqus comment system works. (In this particular case, the code comes from an on-site membership script - and to modify I'd have to edit the core... which I don't want to do. So, although I can edit the page, I can't modify all parts... hence the hope for using str_replace to modify things. I now realise that my initial understanding of it was wrong... I thought it would work in a 'global search and replace' way, through a single bit of php positioned somewhere in the code. I now know that I have to position it directly where the replacement is to happen. So - problem sort of solved.
  3. New to this... can I use str_replace to replace all instances of a specific word or html tag on a page? I have an html page containing elements produced elsewhere and which I can't remove by simply editing the html. If I've understood str_replace properly, I can add a bit of php to the page and it'll modify things - so in this way I'm hoping to use it to remove some unwanted br tags from code which I can't directly edit.
×
×
  • 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.