Is this possible?

Discussion in 'PHP' started by Agent_Smith, May 28, 2008.

  1. #1
    Okay,

    I think this may work, here is the scenario.

    file 1, will be encoded in ioncube. file one contains all the variables and database connection details for that page.

    file 2, is a html file. This contains the template data. This is not encoded. This page is a form, however, there is a problem. There is a drop down box, but the fields are in a mysql database. It is a html page, no php variables can be placed.

    So, would something like this work?

    file1 gets the results for the fields from the database.
    file2 has a special tag where the drop down box should go.

    File2:
    
    %{drop}%
    
    Code (markup):
    File1:
    $content = file_get_contents("file2.html");
    
    str_replace(%{drop}%,$variable,$content);
    PHP:
    Thanks!
     
    Agent_Smith, May 28, 2008 IP
  2. Dagon

    Dagon Active Member

    Messages:
    122
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #2
    sure works
     
    Dagon, May 28, 2008 IP
  3. Agent_Smith

    Agent_Smith Well-Known Member

    Messages:
    890
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    145
    #3
    Okay works fine... one issue...

    
    $content = file_get_contents("url/signup.php");
    
    $content0 = str_replace('%{cat}%',Category(),$content);
    
    echo $content0;
    PHP:
    Some reason, its just randomly dumped my function "Category()" randomly on the top of the html. Where if i change that into a single word etc, it's placing it where it should go, in the correct table space.

    Any ideas?

    Thanks
     
    Agent_Smith, May 28, 2008 IP