Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    49
    Thanks
    7
    Thanked 1 Time in 1 Post

    replace code in php output

    Hi all,

    I have this php output:
    Code:
    <form><input type="submit" name="submit" value="Update Cart" class="inpSubmit"></form>
    and I'm trying to replace the input of this form with str_replace:
    PHP Code:
    <?php

    $search  
    = array('<input type="submit" name="submit" value="Update Cart" class="inpSubmit">');
    $replace = array('<button type="submit" name="Submit"><span class="buttonSubmit"><em><b><strong>Update Cart</strong></b></em></span></button>');
    $subject = array('<form><input type="submit" name="submit" value="Update Cart" class="inpSubmit"></form>');

    echo 
    str_replace($search$replace$subject);

     
    ?>
    But $search and $subject arrays was taken from php output, not from php source code.
    Unfortunately I can't access to the source code (because it's in the engine files due to it needing to be built dynamically).

    Then is it possible to replace this code in php output?

    Thank you very much

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,546
    Thanks
    45
    Thanked 259 Times in 256 Posts
    I at least would need more information like, do you want the change in one place or everywhere, what engine, etc.

  • #3
    New Coder
    Join Date
    Jun 2009
    Posts
    49
    Thanks
    7
    Thanked 1 Time in 1 Post
    I want the change everywhere (only output is important).
    The engine is ioncube (zend) encoded (but I can NOT edit the ioncube encoded files).

    I was trying to add that php code (str_replace) on a page that isn't ioncube encoded but that includes an ioncube encoded file.


    Unfortunately I can't edit the ioncube encoded file and I don't know its real php code.

    Then maybe it's possible to replace this php output of included ioncube encoded file:
    Code:
    <form><input type="submit" name="submit" value="Update Cart" class="inpSubmit"></form>
    Thank you very much
    Last edited by Maurizio1230; 06-20-2010 at 11:48 AM.

  • #4
    New Coder
    Join Date
    Jun 2009
    Posts
    49
    Thanks
    7
    Thanked 1 Time in 1 Post
    Maybe something with ob_start?
    I'm getting crazy!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •