Another question about controller pages

edited September 2011 in Modules
Ok so i've basically modified the contact controller that comes with the fuel package. If I just go to the url /contact nothing shows up (as expected). Now if I create a view file called contact.php then go to the url /contact, my main template appears with the contents of contact.php in there (again as expected).

Now if I go to the admin, add a contact page and give it the location "contact", click save, it asks if I want to import the contents of views/contact.php so I click yes. Then I change the text in the admin and click save, voila, no changes to the url /contact. I try clearing the cache and it doesn't help.

Any ideas on where i'm going wrong on this one?

Comments

  • edited 5:31AM
    What is the fuel_mode set to in the fuel/application/config/MY_fuel.php file set to? For a view from the admin to show up, it needs to be set to "auto" (or "cms").
  • edited September 2011
    It's set to auto. Do I need to have some sort of fuel_var or something in my view? In my original view I just had 1 line
    <h1>Testing contact page</h1>

    and then in the admin panel I added another line so it now looks like this.
    <h1>Testing contact page</h1> <h2>YUP TESTING</h2>

    When I make edits in the admin panel, they don't appear on the website and i'm not sure if I need some fuel variable or function in my view file or not.
  • edited 5:31AM
    Could it be something to do with the layout you are using for creating the page in admin?

    If Admin(David) can help here - If I am right and you import a page, for it to be editable from admin, you would need to make sure that your view page has variables that will be picked up by admin? ie, set your layout up in my_fuel_layouts?
  • I'm using the default "main" layout. I think that i'm missing some code in my view file that allows them to be editable in the admin, but i'm not sure if that's actually true.
  • edited 5:31AM
    I think I see the problem. Add the following to your $page_init variable in the controller:
    $page_init = array('location' => 'contact', 'render_mode' => 'cms');
    Let me know if that does the trick.
  • That worked! Thanks alot. Are you going to commit that so that new downloads will have that automatically?
  • edited 5:31AM
    In your case, you specifically wanted it to pull from the cms, however, it's possible to just create a contact view file and have it work too. So in short, I probably won't.
  • Gotcha.
Sign In or Register to comment.