Jump to content


Photo

global content in footer + settings page


  • Please log in to reply
3 replies to this topic

#1 Scott

Scott

    Newbie

  • Members
  • Pip
  • 2 posts
  • 1

Posted 27 March 2012 - 05:32 PM

hi guys.

just starting out using PW and loving it so far. incredible work, Ryan! i haven't used CMSs too much in the past, but tried out enough and researched enough to know that PW is awesome and just makes simple sense in so many ways.

i've been reading a lot about PW, but i can't seem to find any example of the best practice for creating global "shared" content, like for example, a footer with contact info to be the same across all pages.

i have 1 idea, but not sure if it's the preferred method - i want to start out using the right method.

should i do this, or something else?
create a "footer" template and page, make the page status Hidden so it doesn't show up in navs, etc, and pull content from it to all pages using something like:

$footer = $pages->get("/footer");
echo $footer->body;

// or maybe better yet (i'm just starting out, i think this is the shorthand):
echo $pages->get("/footer")->body;

or am i missing a key concept of how to do this a different way?



and, on a related note: would i do something similar if i wanted to have a "settings" page where the user would fill in things like their Facebook page URL, Twitter name, etc.? then wherever i had a Facebook logo to link to FB or a Twitter logo to link to Twitter, i'd pull in that field from the "settings" page like this?

echo $pages->get("/settings")->twitter_name;

your help is very much appreciated. thank you!

#2 diogo

diogo

    Hero Member

  • Moderators
  • 1,988 posts
  • 1062

  • LocationPorto, Portugal

Posted 27 March 2012 - 06:14 PM

Hi Scott! Welcome to the forum!

There isn't really a right way. One of the good things about PW is that it lets you create your own way of doing things.
With that said, I think you are on the right track. You can create a settings page, with a settings template, and do exactly as you showed on your template file. The best way would be creating the "settings" template without creating a template file, since you will output the content through other files. For the footer, you can also do like you said, but I would keep it more semantic, like - instead of calling it footer, I would call it contacts, and copyright, and people... you get it :)

#3 ryan

ryan

    Hero Member

  • Administrators
  • 5,771 posts
  • 3109

  • LocationAtlanta, GA

Posted 28 March 2012 - 08:49 AM

Welcome to the forums Scott! You are definitely on the right track. I do the same things that you mentioned. I also sometimes use the homepage template for holding fields that will be used site-wide.

#4 Scott

Scott

    Newbie

  • Members
  • Pip
  • 2 posts
  • 1

Posted 28 March 2012 - 12:27 PM

great, thanks diogo and ryan! i'll try out those methods and see which ones feels right for my site. thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users