Thursday, October 2, 2008

Re: trying to add new pages and use same layout page in Bakesale

I also found some code in the routes.php which I copied and changed
for users, but it does not help yet . ( I have renamed the index views
and functions - show ) trying to replicate the other senarious.

// SEO setting for products
Router::connect('/:myvar/p/*',
array('myvar' => null, 'controller' => 'products', 'action' => 'show'),
array('myvar' => '.*')
);

Router::connect(
'/:slug-p-:id.html',
array('controller' => 'products', 'action' => 'show'),
array(
'pass' => array('id', 'slug'),
'slug' => '.*',
'id' => '[\d]+'
)
);

// SEO setting for users
Router::connect('/:myvar/u/*',
array('myvar' => null, 'controller' => 'users', 'action' => 'show'),
array('myvar' => '.*')
);

Router::connect(
'/:slug-p-:id.html',
array('controller' => 'users', 'action' => 'show'),
array(
'pass' => array('id', 'slug'),
'slug' => '.*',
'id' => '[\d]+'
)
);

On Thu, Oct 2, 2008 at 6:52 PM, gabriel <gkolbe@gmail.com> wrote:
>
> Hi All. I am trying to edit the Bakesale library I downloaded from the
> internet, which runs on cake. BakeSale uses, to layouts - admin, and
> show. I have added 2 new sets of controllers, views, models. If I type
> in users/register , it keeps opening up in the 'CakePHP: the rapid
> development php framework' default page, and NOT in the show - layout.
> I have been looking everywhere, and can not findout where they 'force'
> the views to open up in the specific layout. ( I have created a
> 'default' layout - and this kind of work) but this is not what I want
> to do. Does anyone have any ideas, it would be grate - the only code I
> find that might explain it is in the app_controller, posted below.
>
> function beforeFilter() {
> $this->_checkLogin();
> if (!isset($this->params['requested'])) {
> Configure::load('custom/bakesale_config');
> Configure::write('Config.language',
> Configure::read('Site.locale'));
> $this->theme = Configure::read('Site.theme');
> $this->_setDefaults();
> $this->addUrl();
> }
> }
>
> function _setDefaults() {
> $bodyClass = $checked = $selected = '';
> $extraCss = array();
> $isAdmin = $simpleLayout = false;
> if($this->Session->check('Auth.User.role')== 'role') {
> $isAdmin = true;
> }
> $this->set(compact('bodyClass', 'checked', 'selected', 'isAdmin',
> 'extraCss', 'simpleLayout'));
>
> if(!isset($this->params['admin'])) {
> $this->layout = 'shop';
> } else {
> $this->Session->write('Admin.id', '1');
> $this->layout = 'admin';
> }
> }
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: