Vigilante
Members-
Posts
54 -
Joined
-
Last visited
Everything posted by Vigilante
-
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!)
-
OK here is a project I've got going as a training example. Think of it as a company private intranet. I notice in PW you get just one top-level page. I happened to rename mine to "Core" as that is the name of this intranet. This top-level page seems to be what loads at the top-level URL as well. For example if I go to example.com it would load content from Core. However, I need my website set up so that the main menu is something like "Home | Documents | Media | Templates" for example. So here is my first challenge. I create those four pages as sub-pages of Core. They will in turn contain sub-pages of their own. Such as Documents->Employement | Policies | How-to | etc. Even the "Home" page will have sub pages that are more related to the user, such as Home->Profile | Calendar | Messages | Projects | etc The problem I'm having is that by using a Page called "Home", with sub-pages, I now have two "home" pages. In other words, there is now example.com, as well as example.com/home. Technically these should both be the same thing, but they aren't. I have to actually click the Home menu to open the /home/ URL, while typing the domain name example.com loads the information within Core itself. I'm not sure how to make Core and Home be the same page essentially. And if I were to delete the Home page, and put those sub-menus directly under Core, how do I distinguish them from the other top-level menus like Documents and Projects? My tree looks like this: Core -Home -Documents -Media -Templates But what I seem to need is more like: Core -Profile -Calendar -etc -Documents -Media The problem at its root is in how I display these menus on the front end template? I can simply loop through the children of Core to make the main menu, but I can't do that if I DON'T use the Home page. I hope this makes sense. If I loop through children of Core, my main menu would show BOTH my top-level menus (Documents, Media etc) but ALSO the Profile and Calendar which are supposed to be sub-menus of Home, not top-level menus. That doesn't work. I have to instead do like my first example, which is then a piece of cake. Loop through children of Core and that creates the main menu. However, THAT is where I have the problem of two different "home pages", one at example.com (which shows Core), and one at example.com/home/ (which shows Core->Home) My first solution to this was to exclude Home from the loop and instead hard-code the Home link into the main menu to go to example.com, essentially trying to pretend that there is no such thing as example.com/home/. That isn't working so well. I tried to eliminate Home and just use Core directly for my home page content, that isn't proving to be very good either because of the page heirarchy structure and where to put my Home page sub-menus and loop through them. In order for Profile and Calendar and such to be children of "Home", I actually need there to be a "Home" in the first place! Here is what I'm ideally looking for: 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 Logically, I want to loop children of Core and make a main menu which includes a "Home" item that takes me to example.com. And when a user clicks a main menu item, that main menu will have its own landing page and content, but ALSO show the sub-menu, i.e. children of itself. On top of that, when a sub-menu is chosen, that page will load, and continue to show the top-level and sub-menus. There should be visual clues so people know what page they are in. For example if they click Media then that menu item will get a class=active, and if they click Media->Logos, then BOTH the main menu Media as well as the sub-menu Logos, will have a class=active. I had trouble with this because when you click a MAIN menu, I show CHILDREN of $page which creates a sub-menu (works great), but when you click the sub-menu item, children of $page shows nothing. So I have to somehow toggle in the template file whether to show children, or to show siblings for the sub-menu, or perhaps children of $page->parent for example. It's kind of confusing I think. If any of that nonsense made any sense at all, can you help me sort out my logic in how to organize this simple structure? Much appreciated!
-
Thanks for the thoughts and suggestions. I will form a longer reply when I've browse the various things linked in here. As a followup, is PW set up so one can have a classic MVC setup? As a second followup, I'm confused about pages being used as data objects. In other words, in the skyscraper example, instead of storing your architects in a database, he has one page for each name. Same thing with cities, one page for each city. This doesn't seem scaleable. Why would I take data that is clearly suited for a database and make them pages instead? This would be like, I dunno, Amazon storing every book they sell as a page? Or every author? I'm not clear why he would store architects OR the cities as pages instead of database tables. Is this how PW is supposed to work, replacing DB tables with long page listings? thx
-
Hello, I've been playing with PW for a couple weeks and reading through the site and watching some videos etc, but I wanted to ask a few specific things. One thing I want to know is, what is the best way to start a completely blank project? When I unzip PW into a web folder, I spend more time renaming things, removing things, file shuffling, editing existing pieces, than if I could just start with a blank project. What is the best way to do this? Do I just empty everything from the templates folder? Not sure what is required and what is optional. Second, I build websites in PHP/MySQL and mainly work on administrative websites, or sites that are heavily user-access controlled. That said, almost every page in my website has very different content that does not seem to lend itself to the template/pages system of PW, unless I'm doing it wrong. For example, on one website there is a "Documents" top-level page with a few sub-pages like "Policies" and "Forms" and "Media". All the pages have their own landing page. So for example if I click Documents, it will not only show the three subpages in a submenu, but it will show a main page as well with things like statistics, recent downloads, recent updates etc. All 4 of these pages would be quite dynamically built, with information pulled from a database and assembled on the fly. How do I do this in PW? I can write lots of PHP inside templates and do a lot of PHP/MySQL work there, but I can't do that in Pages. So I'm confused, it sounds like for my sites all my "pages" are actually templates because that is where I do a lot of dynamic PHP stuff, and then I match each template to one page to show it. This doesn't seem right. Here is what my brain is saying should happen: I would create one single template, just one, because all the pages of my site share the same general symantic structure and main menu system, logo, header, footer, login box, search box, etc. Then I create lots of pages for each section and sub-section of the site. However, I can't do all my PHP work inside pages, I can only put basic info inside fields, which isn't even all that helpful, but seems to be the driving benefit of PW in the first place. In other words, I don't want to fill in some predefined fields for all of my pages, I need to write a crap ton of PHP code for each one of my pages. How do I do that? It seems that Pages are not actual files, but Templates are, so I can code in templates but can't code in pages. I don't know what I'm missing here. The idea is that when a page loads such as Home->My Profile, this is where a user is logged in and goes to edit their profile. In a normal PHP project, I would log them in, and use some kind of dynamic "profile.php" file that would be included in the main template, then I would grab all the user's info from a DB and let them edit it. The profile.php page would probably call some PHP class file, use a bunch of methods and so on. In a normal PHP project, everything would start with an index.php file, which would then build the template structure, and finally include the "page" PHP file for the dynamic information that needs to be shown. I'm not sure how this structure works for PW. Do I create separate "templates" for every dynamic page on the website so that I can do PHP coding in them? If I do all my coding in the template, that what is the purpose of the page? And it's also not good to have 25 template files all duplicating basic symantic structure. I like to write DRY code so the PW template/page system is not making a lot of sense to this PHP programmer. Where do I write my PHP code for all my pages in a PW site? Thanks for any advice!