app-controllers-pages_controller
Hello all, This is the first time I have posted. I am relatively new to cakePHP. I have been working with an application and have run into something strange. My app/controllers/pages_controller is acting very strange. It works just fine in my development environment. I can view, add, edit and delete pages. I uploaded it into my host and now it doesn't work. At one point, it did, but now it's acting up. I first discovered the issue a couple of days ago when I tried to edit a page. When I tried to save it, it redirected me to the edit page and deleted my changes. It shows old pages in the views. I even made my changes in my development environment and imported the SQL into the database manually. I tried deleting the pages and according to the list in my admin area, they are gone, but the database shows that they are still there. This is all very strange. Has anyone seen this before? My site is on the live server, but our site hasn't officially gone live. These are important informational pages that need to be viewable and accurate. How could this work in one environment and stop working in another? Any help would be appreciated. Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: app-controllers-pages_controller
Sounds like there is something wrong with your code and without seeing it hard to debug. You also mention lots of different errors with editing, deleting etc. Find the the most concise piece of code that you believe should be working but isn't. Paste that code to pastebin (http://bin.cakephp.org) and provide a link here along with what you think should be happening and what is happening instead. If your site is live, it can also help to tell us at what address so we can see the error for ourselves. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: pages_controller
On 26 feb, 22:58, Krissy Masters naked.cake.ba...@gmail.com wrote: Maybe because I never used it in my journey with Cake so far, but the pages controller. I understand the basic idea of rendering static pages display = some_page but how can you define different layouts for each rendered static page? $this-layout = 'x'; in your view files. you don't need to change the pages controller at all for that. AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
RE: pages_controller
LOL...right! Thanks man. So simply overlooked. K -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: RE: pages_controller
Wish I would have made it to this post earlier : ) ... I ran into the same issue and complicated it beyond belief! But it's as simple as stated above. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
pages_controller
Maybe because I never used it in my journey with Cake so far, but the pages controller. I understand the basic idea of rendering static pages display = some_page but how can you define different layouts for each rendered static page? All I can guess is pages_controller: function index (){ $this-layout = 'default_index'; } function about() { $this-layout = 'default_internal'; } And just skip the display function. link directly to the action controller = pages , action = index Am I wrong? Thanks, K -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: pages_controller
On Feb 26, 2011, at 15:58, Krissy Masters wrote: the pages controller. I understand the basic idea of rendering static pages display = some_page but how can you define different layouts for each rendered static page? All I can guess is pages_controller: function index (){ $this-layout = 'default_index'; } function about() { $this-layout = 'default_internal'; } And just skip the display function. link directly to the action controller = pages , action = index Am I wrong? Why do your static pages have different layouts? I would have expected your static pages (and your dynamic pages too, for that matter) to use the same global layout, and only need a separate view file. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
RE: pages_controller
Not sure what you're getting at? The view is the guts of the page. View gets dropped into the layout. Index page has a fat header with 400px high. Im not going to code that into every view div header this view and internal pages do not have a fat header so why put that inside the view every time? Imagine changing the image in every page or just 1 layout header? 2 layouts left_default or right_default by saying this-layout which ever I want I can change the page look do not have to go into each view and re-code the cols Example layout div id=container div id=header?php echo $this-Element('block_header', array('cache' = forever)); ?/div div id=sub_nav?php echo $this-Element('crumb_block', array('cache' = forever)); ?/div div id=content div id=l_230?php echo $this-Sidebar-getSidebar(); ? /div = my side gets dropped in here div id=r_710 ?php echo $content_for_layout; ?/div = my view html gets dropped in here /div /div div id=footer?php echo $this-Element('block_footer', array('cache' = if I feel like it)); ?/div Ok changed my mind div id=container div id=header?php echo $this-Element('block_header', array('cache' = forever)); ?/div div id=sub_nav?php echo $this-Element('crumb_block', array('cache' = forever)); ?/div div id=content div id=1_710 ?php echo $content_for_layout; ?/div = my view html gets dropped in here div id=r_230?php echo $this-Sidebar-getSidebar(); ? /div = my side gets dropped in here /div /div div id=footer?php echo $this-Element('block_footer', array('cache' = if I feel like it)); ?/div All I had to do was $this-layout = default_left to default_right, never touched the view could not be easier than that. If I want to use a different layout use left_side or right side I can just use either layout. Your not saying code each view with left_col right_side inside the view? So if you want to change from left to right or see what it looks like you have to recode the view I guess your layouts are just empty? Your view files, you hardcode code the layout cols inside every view? div left_colall left data, navigation/div div rightall your code/div Anyways thanks for just answering a question with a question :) -Original Message- From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Ryan Schmidt Sent: Saturday, February 26, 2011 8:39 PM To: cake-php@googlegroups.com Subject: Re: pages_controller On Feb 26, 2011, at 15:58, Krissy Masters wrote: the pages controller. I understand the basic idea of rendering static pages display = some_page but how can you define different layouts for each rendered static page? All I can guess is pages_controller: function index (){ $this-layout = 'default_index'; } function about() { $this-layout = 'default_internal'; } And just skip the display function. link directly to the action controller = pages , action = index Am I wrong? Why do your static pages have different layouts? I would have expected your static pages (and your dynamic pages too, for that matter) to use the same global layout, and only need a separate view file. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: named parameters in pages_controller
try $url = $html-url( array('controller' = 'posts', 'action' = 'view', 'id' = 12, 'param' = 'name)); echo $url; On Jan 13, 8:56 pm, blickensdoer...@googlemail.com blickensdoer...@googlemail.com wrote: hi everyone, i have a problem with the url helper in the pages_controller: i want to append a named parameter to the current url . in all controllers this works fine, but the pages_controller does always something like this: /pages/display/pages/info/param:name i've tried various ways to pass the url to the helper, even things like: $html-url($this-here.'/param:name') but nothing works anyone knows help? ty+regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
named parameters in pages_controller
hi everyone, i have a problem with the url helper in the pages_controller: i want to append a named parameter to the current url . in all controllers this works fine, but the pages_controller does always something like this: /pages/display/pages/info/param:name i've tried various ways to pass the url to the helper, even things like: $html-url($this-here.'/param:name') but nothing works anyone knows help? ty+regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
How to: subpages in pages (pages_controller)
Lets say I want to create a pages called Projects with Software 1 and Software 2 as subpages. How do I do that. Do I create an folder within Pages folder, where an index.thtml file will be the default access when http://www.example.com/pages/projects is requested? I want the 2 subpages at this url: www.example.com/pages/projects/software_1 www.example.com/pages/projects/software_2 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: How to: subpages in pages (pages_controller)
yes, You can create subfolders in app/views/pages, so url example.com/pages/projects/software_1 will look for file app/views/pages/projects/software_1.thtml If You want example.com/pages/projects then create file app/views/pages/projects.thtml --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: How to: subpages in pages (pages_controller)
Thanks, looking forward to try it out.. Gerhard On Apr 23, 2:10 pm, jitka [EMAIL PROTECTED] wrote: yes, You can create subfolders in app/views/pages, so url example.com/pages/projects/software_1 will look for file app/views/pages/projects/software_1.thtml If You want example.com/pages/projects then create file app/views/pages/projects.thtml --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Setting view variables from pages_controller??
Hi all, I have setup a pages_controller.php with the following function to call the static homepage (home.thtml): function home() { $this-set('searchElement', $this-requestAction('/docs/ search', array('return'))); $this-display(); } However on home.thtml, it says the the variable $searchElement is undefined. Does anyone know how to pass variables from pages_controller.php to its views? Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Setting view variables from pages_controller??
as far as I know... you've got it right. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: pages_controller
I think you might be happier if you split the functionality into two different controllers.I have modified the default pages controller to add a few tweaks by first copying it to my app directory. I then renamed it to static_controller.php, modifying the code and the views directory appropriately. I then created my own new 'pages_controller.php' which is actually a content management system.The way the default pages controller (which is now my 'static' controller) is setup it is not meant to have multiple actions defined. On 9/14/06, Chris Lamb [EMAIL PROTECTED] wrote: Evening.On Thu, 14 Sep 2006 14:43:17 -0700, [EMAIL PROTECTED] wrote: I have added my own function to the pages_controller: function test() { $this-set('abc', 'something'); } The controller does load the correct view! (test.thtml) But the $abc var is Undefined!What's happening is that the routes are configured so that all URLs in the form /pages/something actually call the display() function inpages_controller, regardless of what something is.You can confirm this by putting die('in test function') inside test() - it won't get called.As for a solution. try adding another route in core/routes.php:$Route-connect('/pages/test', array('controller' = 'pages', 'action'= 'test'));And then modify pages_controller.php: function test() {$this-set('abc', 'something');$this-display()}Might be a nicer way of doing it, however.Regards,--lamby-- Chris Lamb, Cambs, UKWWW: http://chris-lamb.co.ukQ. Why is top posting bad? GPG: 0x634F9A20A. Because it breaks the logical sequence of discussion --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: pages_controller
Afternoon. On Fri, 15 Sep 2006 00:04:59 -0700, John Zimmerman wrote: I have modified the default pages controller to add a few tweaks by first copying it to my app directory. I then renamed it to static_controller.php, modifying the code and the views directory appropriately. Did you consider extending PageController instead? Being able to still call $this-display() is quite useful from a maintainability aspect imho, as this function is quite well known to most Cake'ers. The way the default pages controller (which is now my 'static' controller) is setup it is not meant to have multiple actions defined. What's wrong with multiple actions OOI? They will always return 404 if you do not have a view for them. Regards, lamby -- Chris Lamb, Cambs, UK WWW: http://chris-lamb.co.uk Q. Why is top posting bad? GPG: 0x634F9A20 A. Because it breaks the logical sequence of discussion signature.asc Description: PGP signature
Re: pages_controller
Chris Lamb: Nice. It worked when I modified the roues.php :) it was not necessary to call the display function in test function. I had problems passing variables through the url, so I discarded the idea of modifying the original pages controller, and did it the same way as John did. John Zimmerman: I just tried your suggestion and that worked very well. (renamed pages_controller to static_controler and created my own new pages controller.) Thanks guys. I was totally stuck with that problem! It is really nice when people have the patience to help us newbie's. Best regards. Asbjørn Morell. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: pages_controller
On 9/15/06, Chris Lamb [EMAIL PROTECTED] wrote: On Fri, 15 Sep 2006 00:04:59 -0700, John Zimmerman wrote: I have modified the default pages controller to add a few tweaks by first copying it to my app directory.I then renamed it to static_controller.php, modifying the code and the views directory appropriately.Did you consider extending PageController instead? Being able to stillcall $this-display() is quite useful from a maintainability aspectimho, as this function is quite well known to most Cake'ers. For my projects I found it much more maintainable to separate the two controllers. I wanted to use the 'Pages name for a content management system, so it made sense for me to just create the static_controller for static pages. The way the default pages controller (which is now my 'static' controller) is setup it is not meant to have multiple actions defined. What's wrong with multiple actions OOI? They will always return 404 ifyou do not have a view for them.With multiple actions inside of the default pages controller requires you to write a route entry for each action beyond the display action (as far as I can tell). Otherwise the pages/* route will try to send your parameters to the display action. I found it much cleaner to separate the two controllers rather than have 1 controller that required another route modification.Also having that route modification (i.e. pages/dynamic ) or whatever your new action would be called would cause a static page called ' dynamic.thtml' to no be displayed. That is fairly minor, but is a collision none the less. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
pages_controller
I have added my own function to the pages_controller: function test() { $this-set('abc', 'something'); } The controller does load the correct view! (test.thtml) But the $abc var is Undefined! I tried everyting, and can't figure out what is wrong! It works perfect if I put the function in an other controller. The reason I want this is because I would like to put all my really simple actions in one controller. E.g page about_us has a menu and 4 bottoms. (stuff like that) Best regards. Asbjørn Morell. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: pages_controller
Evening. On Thu, 14 Sep 2006 14:43:17 -0700, [EMAIL PROTECTED] wrote: I have added my own function to the pages_controller: function test() { $this-set('abc', 'something'); } The controller does load the correct view! (test.thtml) But the $abc var is Undefined! What's happening is that the routes are configured so that all URLs in the form /pages/something actually call the display() function in pages_controller, regardless of what something is. You can confirm this by putting die('in test function') inside test() - it won't get called. As for a solution. try adding another route in core/routes.php: $Route-connect('/pages/test', array('controller' = 'pages', 'action' = 'test')); And then modify pages_controller.php: function test() { $this-set('abc', 'something'); $this-display() } Might be a nicer way of doing it, however. Regards, --lamby -- Chris Lamb, Cambs, UK WWW: http://chris-lamb.co.uk Q. Why is top posting bad? GPG: 0x634F9A20 A. Because it breaks the logical sequence of discussion signature.asc Description: PGP signature
Customizing pages_controller
Does anyone have any insight on how to customize PagesController (pages_controller.php)? I want to add my own methods like add, edit, and delete but I can't get it working. First, I copied cake/libs/controllers/pages_controller.php to app/controllers and added my own method called add(). I browsed to /pages/add in my browser and I got an error about a missing view. Okay, that makes sense. So, I made my view file (app/views/pages/add.thtml) with a form to submit data to /pages/add using $html-formTag. I browsed to /pages/add and I saw my form. Hooray! I filled out my form and submit it but nothing happens, it just returns to my page. So, to test, I add a simple echo command to the add() method but it doesn't work, the echo command doesn't run. I also tried using $this-set('testing', 'testing') in pages_controller.php and echo $testing in add.thtml and still no luck. I also tried not using the word 'page'. So, I renamed pages to posts in my filenames, classes, and database. So, to clarify, I renamed pages_controller.php to posts_controller.php (PagesController to PostsController), page.php to post.php (Page to Post), views/pages/ to views/posts/, and my table pages to posts. That works! So, I can't use the word 'page' because it's already used by CakePHP. Am I right about that? Just so you know, I'm kinda following the blog tutorial on CakePHP.org for reference. Does anyone know a way to use PagesController? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---