Jump to content

StrangeWill

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Everything posted by StrangeWill

  1. date_default_timezone_set('UTC'); echo("<br><br>Local:".time()); echo("<br>UTC:".date('U').'<br><br>'); I was being lazy and was hoping I could get UTC time without having to put in the time offset of the server. Can this be done?
  2. Maybe I can combine all the strings, save them as a file, then include them? I dunno if thats a good idea or not though... we'll see.
  3. [quote author=thorpe link=topic=117155.msg479348#msg479348 date=1165358475] Can we see what $Data looks like before you try and use eval() on it? What is the ouput of...? [code=php:0] $Data = preg_replace($RegEx, $RegExReplace, $Data, PREG_SET_ORDER); die($Data); [/code] [/quote] [code]<p>$this->Site->Config['site']['title']</p> <p>$this->Site->Config['site']['path']</p>[/code]
  4. [quote author=thorpe link=topic=117155.msg478989#msg478989 date=1165312641] Yeah Im sorry, but I really cant see what it is your trying to achieve. [/quote] Okay.... I got these values: $this->Site->Config['site']['title'] = "test 1"; $this->Site->Config['site']['path'] = "test 2"; I got a string: [code] <p><?=$this->Site->Config['site']['title']?></p> <p><?=$this->Site->Config['site']['path']?></p> [/code] I want it to output: [code] <p>test 1</p> <p>test 2</p> [/code] As if it was rendering a PHP page from the string. Run it like code.
  5. Well... I heard you can compile and run C# programs on Linux with Mono.... With PHP you can run commands to the server.... I think technically you can.
  6. Bump (Hehe now that I posted all the code no one cares :P... I'm patient, it is kind of hard to figure this one out...)
  7. Sorry didn't have access till this morning: [code=php:0] class Wolfram_Studios_Template extends Wolfram_Studios_Base { //Template data in array var $TmpVar; var $TmpDir; var $TmpMain; function Wolfram_Studios_Template($inSite) { $this->Name = "Wolfram Studios Template"; $this->Version = "1.0.0"; $this->Site = $inSite; $this->Site->AddComponent($this); $this->TmpDir = $this->Site->Config['site']['path']; $this->TmpMain = $this->Site->Config['site']['path'] . $this->Site->Config['site']['template_path'] . 'main.tpl'; } function DisplayTemplate($TemplateName) { //Open the template and get all the variables ({var}) $Filename = $this->TmpDir . $TemplateName; $File = fopen($Filename, 'r'); $FileSize = filesize($Filename); $Data = fread($File, $FileSize); fclose($File); $RegEx = "/{(.*)\.(.*)}/"; $RegExReplace = '$this->Site->Config[\'\\1\'][\'\\2\']'; $Data = preg_replace($RegEx, $RegExReplace, $Data, PREG_SET_ORDER); eval("\$Data = \"$Data\";"); echo($Data); } } class Wolfram_Studios_Base { //Parent Site var $Site; //This component's data var $Version; var $Name; var $Requirements; function AddRequirement($InComponenetName, $InComponentVersion) { $this->Requirements[sizeof($this->Requirements)] = array('Name' => $InComponenetName, 'Version' => $InComponentVersion); } } [/code] I call DisplayTemplate($TemplateName) under the Wolfram_Studios_Template object I created.
  8. [quote author=thorpe link=topic=117155.msg478295#msg478295 date=1165217476] Can we see the code you've tried? You are also aware that the keyword $this will not work outside of an objects context? This is more than likely your issue buit I would need to see code first. [/quote] Yes, I'm using objects, using: echo($this->Site->Config['site']['title']) will print the correct data. Basically I'm taking this: [code] <p>{site.title}</p> <p>{site.path}</p> [/code] I'm translating it into PHP via RegEx: [code] <p>$this->Site->Config['site']['title']</p> <p>$this->Site->Config['site']['path']</p> [/code] (or if this is better I can do this) [code] <p><?=$this->Site->Config['site']['title']?></p> <p><?=$this->Site->Config['site']['path']?></p> [/code] I COULD cache this to a file, then include() it, but that becomes rather messy, I'd much rather process it as IF it was a php page into the $Data string, I read you do this with eval(), and then insert it into the page.
  9. I want to process this: [code]<p>$this->Site->Config['site']['title']</p> <p>$this->Site->Config['site']['path']</p>[/code] Which is a string, as if it was code.
  10. Now if I could somehow say "include the results of this into a variable" that would be awesome! Since I can't I'm using eval()
  11. New code: [code] ?><p>$this->Site->Config['site']['title']?></p> <p>$this->Site->Config['site']['path']?></p><? [/code] Comes out: [code] ?><p><?=Object id #1->Config['site']['title']?></p> <p><?=Object id #1->Config['site']['path']?></p><? [/code] It doesn't process it even though that runs through the eval()
  12. I have also tried passing $Config[][] vars to a local variable, no luck. I'd rather do straight up variable passing though.
  13. [quote author=Cenobitez link=topic=117156.msg477734#msg477734 date=1165106008] Like i said procode, I have never used it, or any others back in the day, i used ubb and phorum, but not used IPB, looks very like an SQL Injection dropped their tables, which leads to believe its insecure. [/quote] Either using an old/illegitimate version... or modifications caused it.
  14. [quote author=DesertRain link=topic=117156.msg477727#msg477727 date=1165104902] Thanks! But, they are hosting it... downloaded it from Invision Power Board [/quote] Contact IPB tech support... If you're not a customer, stop stealing their software.
  15. I read using eval() is a lot more efficient way than say... downloading smarty templates (just adding the templates, not even fully implementing them, triples my page load time), but I'm having a major problem: [code=php:0] $RegEx = "/{(.*)\.(.*)}/"; $RegExReplace = '$this->Site->Config[\'\\1\'][\'\\2\']'; $Data = preg_replace($RegEx, $RegExReplace, $Data, PREG_SET_ORDER); eval("\$Data = \"$Data\";"); echo($Data); [/code] $Data: [code] <p>{site.title}</p> <p>{site.path}</p> [/code] $Data before eval() [code] <p>$this->Site->Config['site']['title']</p> <p>$this->Site->Config['site']['path']</p> [/code] Good :D $Data after eval() [code] <p>Object id #1->Config['site']['title']</p> <p>Object id #1->Config['site']['path']</p> [/code] Object id? WTF?! No bad! BAD code! Run the WHOLE code, ugh! If I do a echo($this->Site->Config['site']['path']); it prints the code fine... some kind of issue with eval()
  16. Awesome, thanks, I see what I was doing wrong now :P
  17. <?php class Student { var $varName,     $varPhone,     $varTest; function Student() { } } ?> <?php $Kyle = new Student(); $Kyle->$varName = 'kyle'; $Kyle->$varPhone = 'phone number'; $Kyle->$varTest = 'test'; ?> Name: <?=$Kyle->$varName?> <br /> Phone: <?=$Kyle->$varPhone?> <br /> Test: <?=$Kyle->$varTest?> All of them print 'test' No matter what, it always prints the last variable entered! Gah! Using PHP 4.4.2
×
×
  • 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.