Jump to content

_init _main and basic-page


bwakad
 Share

Recommended Posts

From what I have seen on my server folder I have several files located under templates (I use ProcessWire 2.4 with foundation 4 site profile):

_inti.php

It has this code (removed all comments from it for readability):

<?php
$browserTitle = $page->get('browser_title|title');
$headline = $page->get('headline|title');
$body = $page->body;
$side = $page->sidebar;
$body = str_replace(
    // find these:
    array('<h2>', '<ul>', '<ol>'),
    // and replace with these:
    array('<h2 class="subheader">', '<ul class="in">', '<ol class="in">'),
    // in the $body text
    $body);
$useMain = true;
$homepage = $pages->get('/');
require_once("./_nav.php");

So what I understand from this is that it collects the title and displays that in the browser search and as the headline.

Then it sets the variables for body and sidebar parts.

I guess $useMain means it will use the _main.php as a template file.

And then it set the / for the url part.

It then includes the file for navigation.

_main.php

In this file probably all the stuff go on...Some topics mention head.inc and footer.inc, but I have it in one file. Inside it has parts for:

<head></head> <body> <aside></aside> </body> <footer></footer>

And the question becomes with this code:

<?php
echo renderBreadcrumbs($page->parents);
echo $page->select_sector->title; // this was just for testing a select value
echo $body;
?>

If I want to collect data on this page, where to do this?

basis-page.php

only has this code, and I really have no idea what it is suppose to do, I do know that some pages in the admin back-end use it as a template:

<?php
if($page->numChildren(true)) $body .= renderBodyNav($page->children);

home.php

I guess, this page is meant to be the front/home-page? But do I need to remove this file or just some code?

<?php
$body .= renderOrbit($page->images) . renderBodyNav($page->children);
/*
 * Check that required settings are in place.
 * Feel free to remove this if your site already works.
 *
 */
if($config->prependTemplateFile != '_init.php' || $config->appendTemplateFile != '_main.php') echo '
    <h2>Please edit your /site/config.php and set:</h2>
    <pre>
    $config->prependTemplateFile = "_init.php";
    $config->appendTemplateFile = "_main.php";
    </pre>
    ';

The big question is this, If I wanted to have a link which collects from BrancheA>Jobs:

Do I need to make a template file (server side), which collects all data from Branche+Jobs?

Or do I need to place this code inside already present files mentioned above?

I made already a select Branche using pages with page field. But don't know how to continue.

Link to comment
Share on other sites

Just to make it myself more clear I installed skyscapers in another localhost folder - and it almost make more sence to me.

Regarding the _out.php file, does this code mean the url is set to root and just append the hardcoded text cities after it? Where does it get the / from the browser url just after the root?

<li><a id='topnav_cities' href='<?php echo $config->urls->root; ?>cities/'>Cities</a></li>

It then goes to cities.php

include("./browse.php");

and as it says include browse.php

$headline = "Skyscraper " . $page->title;
$browserTitle = $headline;
$content = $page->children("limit=100")->render();

The first two lines are obvious to me, but the third one is a question... how is the sytem knowing it need to collect cities pages - in this case? Is this because of $page represents "cities" from the url in _out.php?

Seeing how this Skyscrapers is working I guess I have to make seperate template files for each entry:

jobs - province // in admin template with fields:

- city

- company

- branche

- skill

jobs - city // in admin template with fields:

- province

- company

- branche

- skill

jobs - branche // in admin template with fields:

- province

- city

- company

- skill

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