|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
newtosmarty Smarty Rookie
Joined: 06 Jul 2015 Posts: 5
|
Posted: Mon Jul 06, 2015 10:14 am Post subject: Only variables should be passed by reference error |
|
|
Hello,
I am new to smarty and I need some help fixing the following error.
PHP Strict Standards: Only variables should be passed by reference in /home/XXX/public_html/h1.com/includes/Article.class.php on line 30
Here is the code of Article.class.php --> loadByUrl
public static function loadByUrl($url, $type = null)
{
$url = trim($url);
$conditions = array("articleURL = '$url'");
if($type)
$conditions[] = "articleType = '$type'";
Line 30 ----> return array_pop(Article::listAll(new DBEListCriteria(implode(' and ', $conditions), null, new DBEListOffset(1))));
}
I am using smarty 2.6.28 (2.6.25-dev displayed on screen) with PHP5.5
Thank you for your help,
Phil |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Jul 06, 2015 3:02 pm Post subject: |
|
|
What is line 30 of Article.class.php? You must be passing a variable by reference, you can likely just get rid of the reference. FYI this is not related to Smarty. |
|
Back to top |
|
newtosmarty Smarty Rookie
Joined: 06 Jul 2015 Posts: 5
|
Posted: Mon Jul 06, 2015 3:19 pm Post subject: |
|
|
Called at initialisation time to get all environment variable into $_ENV[site] array:
if($article = Article::loadByUrl(''))
$_ENV[site]->Article = $article; |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon Jul 06, 2015 7:53 pm Post subject: |
|
|
Your definition of Article::getByUrl() contains a reference in parameters list, but you are passing a constant. That will just not work. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|