Jump to content

Help a noob get started!


Vigilante
 Share

Recommended Posts

Core    ( essentially non-existant as far as front-end goes )
  -Home   ( accessible as example.com, don't necessarily need or want example.com/home/ )
    --Profile   ( child of Home, making it easy to loop through for children or siblings )
    --Calendar ( these could literally be under example.com/calendar, as I don't want /home/ )
    --Projects
  -Documents ( child of Core, thus part of main menu when looping children of Core )
  -Media
  -Templates

If this is your ideal structure, there's no need to change only because of the frontend. There are many ways to make the frontend adapt to the structure. One would ve in the htaccess file, others can be done in the templates themselves. Simplest way would have to have simply: $session->redirect($page->child->url);, this would redirect the "core" to it's first child, the "home". The problem with this approach is that you would have "site.com/home" as the url of your home page instead of simply "site.com", the advantages are that you would have a very easy to create navigation and a one-to-one relation between the backend and the frontend. Another approach would be to render "home" from the "core" url, by putting this code on the "core" template: $page->child->render();, and excluding "home" from lists and searches: "settings > hide". Advantage -> you keep "site.com" as your main url,  disadvantage -> you alter the structure and home is not searchable anymore without explicitly including it on find() searches.

Edit: to make it clear, I agree with what Pete says below. My suggestions are only for the case you really want to keep that structure.

  • Like 2
Link to comment
Share on other sites

I don't think there's any need in changing the homepage to "core" and putting a "home" page underneath it.

The way it's setup by default is that all content is a child of the homepage - the homepage being the start of the website.

Why not simply create a "Profile" page under home and put these pages under the Profile page: Calendar | Messages | Projects | etc ? If the user is logged in you then show the Profile page else show a Login page.

Or are you trying to have customised home pages for each user?

  • Like 3
Link to comment
Share on other sites

Each user would have their own home page elements. In other words, the home page template is the same, but info that is shown is different. If you are a manager, you might see info about files or tasks assigned to someone, or you would get notified if you have a file to sign off on. While another user might see their home page showing other types of status. And then there would be elements that all users see, such as public messages, calendar events etc.

I understand the idea of simply putting Profile | Calendar etc directly under Core, or the top-level menu. That's easy, but it's auto-building the front-end menu that takes the hit. When a user opens example.com/page, I can reference that easily with $page and then easily loop the children to create a sub-menu. $page->children. That no longer works because with the children or sibling arrays, I would have top-level and sub-level pages mixed together. "Documents" would be a sibling to "Profile" which is not right. Profile is a child of "Home". Home would be the sibling of Documents.

I think the best suggestion so far is to ignore /home/ and use htaccess or something to redirect it to root. The other way is to stop trying to build auto-menus based on children and siblings and just hard-code my menu structure. That seems inefficient given the nature of the hierarchy setup in PW pages. It is much more logical to code "oh they clicked Home, show children of Home in a sub-menu". "Oh now they clicked Documents, show the children of Documents in a sub-menu". 

My method of web design is focused first on usability and UI on the front end, not on how things are best structured in the back end where users never see. I have an idea of how the site needs to work, so PW needs to support that. This is a very simple front UI, it has one main menu, and each main menu has one sub-menu. That's it, it's not a giant site with thousands of pages and multiple levels deep of the tree. I wanted to design it such that any new item created in the PW tree, is automatically placed in the menus and not hard-coded. I also want Home and the root page example.com to be the same page, no /home/ needed, it's just redundant.

This is how I judge a framework, to design a site and use the framework to get there. Rather than study a framework, and create a site to pander to it's structure and restrictions and methods. Then when a user asks "can I get X feature" I don't have to be like, "well lets see if the framework supports it, or if there is a plugin" etc. I want an open framework that doesn't restrict what people need on the front end. Anyway that is neither here nor there. I'm still playing with PW and testing it for use in future projects. The main draw of PW for me was not using a template engine, I agree with PW that template engines often just build a redundant layer of abstraction to hide PHP but only succeed in creating a new language to learn, and adding overhead and complexity to the site. Other frameworks try way to hard to force MVC, when clearly there is some logic needed on the front end, especially if one makes heavy use of Javascript, which may be using a whole lot of logic itself already.

OK enough rambling! How should I do this page structure? And keep my auto-generating menus on the front end?

(P.S. I still have a lot of reading to do with all the links posted, but I still like discussion too!)

Link to comment
Share on other sites

Each page that is shown is only a template file with fields rendered on it.

So, if the front page of this site, the landing page, is meant to be the users home page, then this is not a problem to use just home.php as default.

Once a user logs in, then the page will display information relating to that particular user. You can also decide what to display based on role - if a user has a particular role (like admin) then you can just check if they have that role before displaying that information.

On the front end of the site, you can display anything you like in any order you like. You do not have to reflect the page tree element for element - people tend to do that simply because it makes it easier to manage, but it is not vital.

So. the ROOT of the site is home. (core has nothing to do with anything here - forget about it).

Home is your landing page and you can use it for anything. So, you could use it for an entire dashboard which is only shown if a user is logged in, or you can use it for something else.

You could write in php

if($user->isLoggedin()){
lots of page stuff 
}else{

login form

}
 

All websites have a landing page and, logically, that page is ALWAYS at the top of a tree. 

Once they are logged in, you can stay on the home page (and home template file) and show them all the bits they need to see on their landing page.

Then you can just build stuff under home:

Home

--Profile

---- Manage

---- Messages

---- My picture

---- My docs

-- Company News

-- Club

---- Club venues

Whatever you need to do.

You can either have a top menu that follows the same logic (but perhaps tell it not to display certain elements unless they are logged in) or you can just have a menu in each section that calls information from any part of the tree you like.

THIS IS IMPORTANT - when we create menus that follow the tree, you will notice that they ignore the home page initially then add it back on.

This means, as far as the front menu is concerned, Home, Profile, Company News and Club would all be on the same level. Even though Profile, for example, is actually a child of Home. 

So, for your front end, Home is your landing page, and the others are you toplevel main menu items.

  • Like 4
Link to comment
Share on other sites

I will have to give that structure a try. So basically turn off the root Core Page and don't put content in it. Then have Home under Core, then everything else branch from Home itself.

I'll let you know how it goes.

I still don't need any kind of /home/ URL though, so I need that Page to be the root URL of the site. Maybe I missed how to do that.

Link to comment
Share on other sites

The default "Home" page (and Home in my list above)  IS root. It is your landing page, so put whatever content into that page/template that you want people to see when they first land. You dont need to put /home/ on your URL to get to it - it is accessed with "/"

No one turns it off or removes it, just changes it to do what they want it to - after all, every website has to have a landing page.

Then just develop the rest of the site from there.

As I said, the way the menus work normally is that home (the site root) is shown as the same level of its immediate children. You don't have to stick to that, of course, but it is the easiest way of doing it. 

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