Jump to content

global content in footer + settings page


Scott
 Share

Recommended Posts

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!

  • Like 1
Link to comment
Share on other sites

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 :)

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 7 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...