Jump to content

foot.inc


ricknew
 Share

Recommended Posts

Hi Folks,

Using a default install, I'm stepping through the tutorials, templates, etc and trying to understand the basic concepts behind processwire and at this point in time "head.inc" &  "foot.inc".

I expected to see the header and footer content available for editing via the admin, but instead I find hard coded content inside the "head.inc", "foot.inc" template files. So, I must have a model that doesn't match the way processwire works.

Also, I was surprised to see child page titles and summaries inside the "foot.inc" template. Since this content isn't part of the footer, why would it be in the "foot.inc" file?

I know I can roll my own and change this, but I'm trying to understand the model and why it was done this way. 

Thanks for your patience.

Rick

Link to comment
Share on other sites

Hi Rick,

head.inc and foot.inc don't represent literally the html <head> or <footer>, they are just there to hold code that is common to most pages. That's why you find navigation and summaries there. They could be called top.inc and bottom.inc or start.inc and end.inc, but those names are generally recognized among developers, so it makes sense to use them on the default install.

You are the one choosing the level of editability (my spellchecker doesn't like this word) of the sites you design. Some times it makes sense that everything is editable, and processwire for sure allows you to do this, other times you want a bigger control over some aspects of the website, and make it available for the editors to change only what's necessary. In the latter case it makes sense to have some content hard coded.

I know I can roll my own and change this

You should do it, we all are. The default install serves only as an example. Ryan created the most simple site that still has some complex snippets of code, here and there, that you can take as example, with few templates and fields, but that represent a lot of you can do with pw. Do as you wishuse some code and some of the fields and templates, or just wipe it all and start from a blank state. But make sure you learn from it because it's full of nice details :)

  • Like 4
Link to comment
Share on other sites

but those names are generally recognized among developers, so it makes sense to use them on the default install.

Obviously not, since newbies associate head.inc with what is between the <head> and </head> tags

and foot.inc with the footer of a webpage. It happened to me and I see it happen again and again to

other newbies. Among experienced developers it might make sense but only after they became experienced

themselves. Confusing associating between words in file names in .inc or .tpl and the same words

between html tags should be avoided.

By the way <footer> is a new tag in html5 unlike <head>

Link to comment
Share on other sites

I would have thought this would suffice

<?php

/**
 * Demo site header include file (HTML5)
 *
 * Note that this file has nothing to do with ProcessWire. We just split our common 
 * header and footer markup into separate files (head.inc and foot.inc) like this, 
 * since it was common to all of our templates. 
 *
 */

?>

That's taken right of head.inc....:)

Link to comment
Share on other sites

There are probably lots of ways to include common content, but the naming convention of "head" and "foot" made this particular approach a bit confusing for me as a newbie. Saying the template files don't have anything to do with ProcessWire doesn't remove the naming association with HTML tags or standard header/footer template blocks.  I'm looking forward  to learning about other approaches to resolving the common content problem. 

Thanks for all the good comments and help.

Rick

  • Like 1
Link to comment
Share on other sites

Ricknew, did you read this thread ? I assume you did.

http://processwire.com/talk/topic/3388-question-about-headinc-and-footerinc/

Pete and diogo commented something more on this issue at the end of that thread.

For a newbie it can be confusing in the beginning that processwire has a very open potential with little cms rules but instead powerful api, fields and total php access. Especially if you are coming from another cms system with conventional cms rules and name standards. Or even worse if you are coming from a wysiwyg website maker. In processwire you can make almost everything dynamic with it's backend. Hence my own confusing in the beginning with what to do with head.inc and foot.inc and the html structure of your new website. Heck in processwire you can generate html structure on the fly with php echo. In processwire you have to be clear first about the static html structure of your webpages and then use the backend and php to replace content between html tags to make everything dynamic. As with everything, a lot of practising will help you learn how to use the open potential of processwire.  Anyway I learned a lot thanks to many pro forum members here.

Link to comment
Share on other sites

The only reason the default profile uses a head (header) / foot (footer) naming convention is because this is what WordPress does, and it's not far off from what Drupal does. So the point is  to provide some point of reference relative to other systems. It's not really the best approach to use once you know what you are doing… though it's also fine to use if it suits your needs. 

  • Like 1
Link to comment
Share on other sites

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...