Hi Nick,
I think you may be going about this in an akward way.
You are making a product catalog but using the pages feature of
Wildflower for displaying products.
I suggest you put your products separate from "normal" pages. Let the
ProductsController handle the products.
You should try to see the controllers as the signposts, Airport
control-tower... they direct trafic and should try to keep to doing
two tings. Deciding what data should be accessed and which view to
display. For example, when you ask how to load the ProductsController
fron within the PagesController you should be looking for the solution
in the Model and the View domains instead. If you want to load product
data you need the Product Model, not the ProductsController.
Possibly:
if ( !empty($data['Page']['modelname']) ) {
App::import('Model', $data['Page']['modelname'] );
$model = new $data['Page']['modelname'];
// or maybe you have to make it a variable first, I forget.
// $model_name = $data['Page']['modelname'];
// $model = new $model_name;
$more_data = $model->getStuffForPageView();
}
(just example code I wrote here in the browser... no error checking,
may have mistakes... the usual disclaimers)
/Martin
On Nov 13, 6:53 am, Nick <[EMAIL PROTECTED]> wrote:
> Basically I am using wildflower cms which is built on cakephp.
> It routes are setup so that / goes to the pages controller.
> I am building a product catalog and could simply have the urls be /
> products/category/product-name
> however I do not want to prepend the controller name in this scenario.
> Right now I have it so that the product controller from the admin side
> will insert rows into the pages table as products are created in the
> products table. Also I created a field in the pages table called
> "controller". By default it is blank however what I want to do is if
> it isn't blank and for example has "Products" in it then I want to
> load the Products controller from within the Pages controller so that
> it can handle pulling the product images, pricing, etc...
>
> I want the controller to be dynamically called.
> Url structure example desired:
>
> /shirts/mens/rockstar-shirt/ - goes to pages controller sees that
> the controller field has "Product" and loads product through Product
> Controller
> /about-us/ - goes to pages controller
> and has blank controller field, page rendered as normal
>
> Im new to cake but like it so far. Also does anyone know of a good
> cake cms, wildflower is slow running as localhost.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---