maexus Posted September 11, 2007 Share Posted September 11, 2007 The issue is isolated here: public $folderCache = 'cache/'; public $secondsCache = 86400; public $urlCache = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; public $fileCache = $this->folderCache.md5($this->urlCache).'.cache'; As the error still posts when open up that class file and that's the only thing in there. Even further, the error goes away then I delete: public $urlCache = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; public $fileCache = $this->folderCache.md5($this->urlCache).'.cache'; Not either or, both of the deleted will make error go away. I know it's something small but I just can't see it. I even tried rewriting it just to make sure. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 11, 2007 Share Posted September 11, 2007 Most of what you wrote does not make sense. "As the error still posts when open up that class file" "Even further, the error goes away then I delete:" "Not either or, both of the deleted will make error go away." Can you please rewrite these? I'm sorry if English isn't your first language but it doesn't make sense. Are you saying both of those lines give you the error? Post the whole error and the line that the line number refers to please. Quote Link to comment Share on other sites More sharing options...
feuerfalke Posted September 11, 2007 Share Posted September 11, 2007 I could be wrong, but I don't believe it's possible to declare members of a class as a variable value. It has to be a constant expression. I assume those values are being declared as members of a class, yes? Edit: Yeah, that appears to be the case. Scroll to example 19.3. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 11, 2007 Share Posted September 11, 2007 Yeah if you want those to have default values that are variables, you have to do it in the constructor. Quote Link to comment Share on other sites More sharing options...
maexus Posted September 11, 2007 Author Share Posted September 11, 2007 Wow, still a little tired. Basically when I remove those two lines (and only those two lines. Not either/or but both), the error does not display. The code and error? ok <?php class cache{ public $folderCache = 'cache/'; public $secondsCache = 86400; public $urlCache = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; public $fileCache = $this->folderCache.md5($this->urlCache).'.cache'; public function start(){ $file_cache_exists = (@file_exists($this->fileCache)) ? @filemtime($this->fileCache) : 0; if ($file_cache_exists > time() - $this->secondsCache){ @readfile($this->fileCache); exit(); } ob_start(); } public function finish(){ $pointer = @fopen($this->fileCache, 'w'); @fwrite($pointer, ob_get_contents()); @fclose($pointer); ob_end_flush(); } } ?> Error: Parse error: syntax error, unexpected T_VARIABLE in /Applications/MAMP/htdocs/lastfm/new/lib/cache.class.php on line 5 Quote Link to comment Share on other sites More sharing options...
maexus Posted September 11, 2007 Author Share Posted September 11, 2007 Ok, thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.