Jump to content

neds75

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

neds75's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have problem with serialize/unserilize array of strings. Actually, it works perfect when I do serialize/unserialize on computers with same OS(linux windown). But when I try to serialize data on linux and unserialize that data on windows(or contrary), I get error(notice). Serialized data are saved in file, no GET/POST or any other data, so magic gpc and magic gpc rantime is not problem(altought it is OFF on both computers). addslashes/strip slashes is not problem too. I lost few hours searchng net for this problem, but I wasn't lucky to find anythting interesting. Is this bug, or maybe problem in some special characters like new lines/CR and so on? If so what woudl be the sollution. Thanks
  2. That script is part of bigger system, and I have to do it thatway. ANyway, I found sollution(got it on another forum), and that is eval() function. Thanks, Ivica
  3. Hi programmers, I have one problem, and don't have idea how to solve it. Here is very much simplyfied code with which I have problem: [code] <?php $variable = "<?php \$v1 = \"10\"; \$v2 = \"50\"; \$output = \$v1+\$v2; @include \"./functions.php\";//This function provde some output too echo \$output; ?>"; $template = "<html> <head><title>Test</title></head> <body> <%variable%> </body> </html>"; $template = str_replace("<%variable%>",$variable,$template); echo $template; ?> [/code] The problem is when I run this script in browser I get next html code: [code] <html> <head><title>Test</title></head> <body> <?php $v1 = "10"; $v2 = "50"; $output = $v1+$v2; @include "./functions.php"; echo $output; ?> </body> </html> [/code] Of course this is totaly expected($variable is string), but I want that all php variables to be substituted with their values when I do echo $template, so I do not want any php code in browser. I solved this problem by writing $template to file, and then called this file via class that imitate browser(snoopy), and it works as I wanted, but the problem is because I have to write to file, and that may be very slow(this is part of template engine). SO my question is: Is it possible to do substitutions somehow in memory, without writing template variable(or $variable) to file and accessing it via browser? I know this is very specific problem, hope someone will have some ideas. Thanks, Ivica
×
×
  • 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.