Re: Can't find my error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 05 May 2010 12:51:00 Ashley Sheridan wrote:
> On Wed, 2010-05-05 at 12:55 -0400, David McGlone wrote:
> > I've checked and checked and re-checked and I can't figure out what I've
> > done wrong. I'm getting a parse error:
> >
> > Parse error: syntax error, unexpected T_VARIABLE in
> > /home/david/www/Joe/current/presentation/smarty_plugins/function.load_pro
> >ducts_list.php on line 27.
> >
> > Can anyone spot my error? I'd appreciate the help.
> >
> > Here is the function.load_products_list.php file:
> >
> > 1. <?php
> > 2. function smarty_function_load_products_list($params, $smarty)
> > 3. {
> > 4.	$products_list = new $ProductsList();
> > 5.	$products_list->init();
> > 6.
> > 7.	//assign the template variable
> > 8.	$smarty->assign($params['assign'], $products_list);
> > 9. }
> > 10.
> > 11. //Manage the products list
> > 12. class ProductsList
> > 13. {
> > 14.	public $mProducts;
> > 15.	public $mSelectedProduct;
> > 16.
> > 17.	private $mBoCatalog;
> > 18.
> > 19.	//constructor initializes business tier object
> > 20.	//and reads query string parameter
> > 21.	function __construct()
> > 22.	{
> > 23.		//creating the middle tier object
> > 24.		$this->mBoCatalog = new BoCatalog();
> > 25.		//if ProductID exists in the query string, we're viewing a product.
> > 26.		if(isset($_GET['ProductID']))
> > 27.		$this->mSelectedProduct = (init)$_GET['ProductID'];
> > 28.		else
> > 29.			$this->mSelectedProduct = -1;
> > 30	}
> > 31.
> > 32.	//calls business tier to read products list and create the links
> > 33.	function init()
> > 34.	{
> > 35.		//get list of products from business tier
> > 36.		$this->mProducts = $this->mBoCatalog->GetProducts();
> > 37.		//create the product links
> > 38.		for($i = 0; $i < count($this->mProducts); $i++)
> > 39.		$this->mProducts[$i]['onclick'] = "index.php?ProductID=" .
> > 40.   $this->mProducts[$i]['product_id'];
> > 41.	}
> > 42. }
> > 43. ?>
> >
> > Just in case Im going to include the template file:
> >
> > {*products_list.tpl*}
> >
> > {load_products_list assign="products_list"}
> >
> > {*start products_list*}
> > <p>Products</p>
> > {*loop through the list of products*}
> > {section name=i loop=$products_list->mProducts}
> > {if ($products_list->mSelectedProduct ==
> > $products_list->mProducts[i].product_id)}
> > {assign var=class_d value="ProductSelected"}
> > {else}
> > {assign var=class_d value="ProductUnselected"}
> > {/if}
> > {*generate a link for a new product in the list*}
> > <a href="{$products_list->mProducts[i].onclick}">
> > $raquo; {$products_list->mProducts[i].make}</a>
> > {/section}
> >
> >
> > --
> > Blessings,
> > David M.
>
> Line 27 is this:
>
> $this->mSelectedProduct = (init)$_GET['ProductID'];
>
> Shouldn't it be (int) not (init)?
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk

WOW!!!! I have spent at least 4 hours reading and re-reading it and it took 
you 3 seconds.

That was the problem. How, how, how could I have overlooked that so many 
times????

Thank you Ashley, I should have asked you 3 hours ago. ;-)
-- 
Blessings,
David M.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux