Re[2]: [PHP] Mixing PHP code with phplib templates... possible?
Hello derek, Tuesday, February 06, 2001, 7:58:25 PM, you wrote: df Hi Max, df Thanks for the reply. Unfortunately, the solution you suggest means df that I would have to do a set_var on all hyperlinks (i.e., define all df hyperlinks everywhere on the site), which is a huge amount of df maintenance. What I thought about yesterday was creating some sort df of token (e.g., {@}) that could be tacked onto the end of df hyperlinks that I want to add session info to. Of course, you can have static hyperlinks in your template, ending with, say, {sessinfo}, e.g. a href='somedir/somescript.php{sessinfo}'blabla/a and then in the script: $tpl-set_var('sessinfo', ((SID) ? '?'.SID : '')) df Maybe there's a df better way... I don't know! :( Another way is to turn output buffering on before processing the template, and after $tpl-pparse(...) save the buffer, and apply a regexp to it, which would append session info to every link on the page. And the last, should-be the best way. Compile PHP with --enable-trans-sid and forget about manual appending the session info to the links and forms. -- Best regards, Max A. Derkachev mailto:[EMAIL PROTECTED] Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 http://www.Books.Ru -- All Books of Russia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Mixing PHP code with phplib templates... possible?
Hello derek, Tuesday, February 06, 2001, 2:28:23 AM, you wrote: df Hi, df Is there a way to embed PHP code in phplib's template files? No. df I need df to run all hyperlinks through a function in order to maintain state df and pass other variables from script to script. I figure this must df be possible, but I'm new at using phplib, so I'm not all that clear df on it... Set the links as template variables and then substitute them with values using Template's set_var(). -- Best regards, Max A. Derkachev mailto:[EMAIL PROTECTED] Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 http://www.Books.Ru -- All Books of Russia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re[2]: [PHP] session question
Hello Teodor, Wednesday, January 31, 2001, 10:49:34 AM, you wrote: TC Hi Mark! TC On Wed, 31 Jan 2001, Mark Green wrote: How about this: session_start(); session_register($funky_session_var); $funky_session_var ++; print $funky_session_var; TC the order doesn't matter (as it did in PHPLib sessions). TC If it doesn't work I guess it's because you have register_globals off. First, I believe the variable should be initialized first (even in favour of common sense), and then registered. Second, session_register($funky_session_var) gives your nothing (if not an error). You should session_register('funky_session_var') instead (the NAME of the variable, not the variable itself). -- Best regards, Max A. Derkachev mailto:[EMAIL PROTECTED] Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 http://www.Books.Ru -- All Books of Russia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Function by reference?
Hello Niklas, Wednesday, January 31, 2001, 7:02:49 PM, you wrote: NS $tmpParsing=eregi_replace("href=(\")([^*]*)(\")","href=\"\\1\"",$this-dataToBeParsed); NS where I want \\1 to be fed into urlencode() I was thinking somewhere along the lines NS $func=urlencode; It won't work. You can not reference a function. But you can call a variable with the function name value. $func = 'urlencode' $func($str) here will do the same as urlencode($str). -- Best regards, Max A. Derkachev mailto:[EMAIL PROTECTED] Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 http://www.Books.Ru -- All Books of Russia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Post without submit?
Hello Chris, Friday, January 26, 2001, 8:23:27 AM, you wrote: C is there anyway to post without clicking a submit button? You can, e.g. using javascript event. onSomething="document.forms['formname'].submit()" -- Best regards, Max A. Derkachev mailto:[EMAIL PROTECTED] Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 http://www.Books.Ru -- All Books of Russia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re[4]: [PHP] declaring variables in class definitions
Hello sam1600, Wednesday, January 10, 2001, 9:55:34 PM, you wrote: sic Assigning something to $d-somevar when it is not declared in the sic definition works fine. Well, if it still does assign to an undefined class property, I'm not sure that this behavior will remain in the future since it violates the OOP paradigm. It looks like a bug, not a feature to me. I'm not sure that PHP should invent its own OOP style. Once in the morning after update to a new PHP version you'll find that you classes won't work anymore if you do such things. sic As far as I can tell, and from what we have found here, there is sic absolutly no reason whatsoever to define variables in class definitions. The classes in PHP are intended to be used as a structured data storage. To use a structure, you should define it first. I guess its no good to have, e.g. two objects of the same class of completely different structure. Btw, there is absolutely no reason to use classes at all with your approach. OOP code in PHP works slower than plain procedural code, and if you have no structure, why use classes? sic If someone can show me me a reason , other than a pure aesthetics, sic why this is nessesary I would sure like to know. If anyone could sic show me at least one example where not defining variables in class sic definitions would somehow break the class, I would like to see it. See above. It's not only an aesthetics. It's a standard. Moreover, it's a common sense. Try to imagine what will say other developer which may use or maintain your code looking at this mess. -- Best regards, Max A. Derkachev mailto:[EMAIL PROTECTED] Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 http://www.Books.Ru -- All Books of Russia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re[2]: [PHP] declaring variables in class definitions
Hello sam1600, Wednesday, January 10, 2001, 7:44:44 PM, you wrote: $d-somevar = true; and the next call to $d-b() will print nothing. But you won't be able to assign a value to $somevar, if it is not declared in the class. sic This does not appear to be true. With error reporting set to max, and the sic variables not defined in the class ( $somevar,$somevar2 and $somevar3 ), sic the following will echo out: sic Not set sic empty sic value of somevar2 sic value of somevar3 sic class a { sicfunction b(){ sic if (!isset($this-somevar)) sic echo "Not setbr"; sic if (empty($this-somevar)) sic echo "emptybr"; sic } sic} sic $d = new a; $d-b(); $d-somevar2 = "value of somevar2br"; $d-somevar3 = "value of somevar3br"; echo $d-somevar2; echo $d-somevar3; try to assign something to $d-somevar if it is not declared in the definition. the method b() of the class a will break if you don't declare $somevar in the class definition. In the string "if (!isset($this-somevar))" it would throw an error saying that you have no variable named 'somevar' in you class. sic This does not appear to be true either, see above. bad practice anyway -- Best regards, Max A. Derkachev mailto:[EMAIL PROTECTED] Symbol-Plus Publishing Ltd. phone: +7 (812) 324-53-53 http://www.Books.Ru -- All Books of Russia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]