processwirefan Posted November 30, 2013 Share Posted November 30, 2013 Hi, I am totally new to ProcessWire and really love it! Specially due to the following reasons: Uses raw PHP for template engine, no Smarty (too heavy) or Twig (I like twig) by default, so no extra learning curve. Easily themeable similar to Modx (but kinda complicated with slow Admin Panel) or Kirby CMS (similar to Stacey CMS but commercial), unlike other CMS like WordPress that impose you with predefined structure. Flexible custom fields (in WordPress it was still kinda painful to use with Advanced Custom Fields plugin, having developed several themes and plugins). Backend admin panel is simple and clean, no learning curve. Thank you Ryan for creating this wonderful CMS! This was the dream CMS I was looking for and regretting for not have found this gem earlier. I am trying create a standard one page website with different sections, for example, similar to: http://tiltingpoint.com and would like create it with the following page and subpage (section) structure in ProcessWire: Home (main page) - Intro section (intro text with a background image, title not necessary) - About section (title and text) - Team section ( display 3 column layout with 3 staff images and text intro below) - Clients section (will display 5 client logo images) - Gallery section (gallery with 3 row x 3 column images that fires lightbox) - Contact form section (a contact form with company address) And here is what I am trying to do: Each section (subpage) will have different custom fields from the others, it's not going to have standard Title and Textarea fields.UPDATE: This is default ProcessWire feature Each section will use it's own template file, so a user just have to enter the required information (text and image), without any HTML structure because it will be predefined inside the template file. I see that the following API command can be used: pages->get("/about/press/")->children(); but it doesn't seem it will load the default template files assigned to them. Or do I have to manually check the assigned template file and insert them into the code? The order of section display should be easily reordered by the user if possible (trying to prevent editing the Home template file directly).UPDATE: Reordering is possible: http://processwire.com/videos/using-the-image-thumbnail-plugin/ The section (subpage) shouldn't be directly accessible by URL, should return 404 not found instead. Looks like setting status to unpublished will work, is this the only option? I am trying to avoid creating all the fields for Home page alone without subpages, because it can be overwhelming to enter all the information at once from a single input page. After searching the forum, the closest thread I've found was: http://processwire.com/talk/topic/4843-pages-vs-repeater/ But I think it still doesn't address the problems I am trying to solve above (I might be wrong). Wondering what's the best way to approach this problem? Should I Include all the section templates from the main Home template (does it even make sense) or is it possible to pull this off from ProcessWire admin panel somehow? Thank you! David -------------------- UPDATE: Looks like the only things left to be solved are 2. and 4. Any tips? Link to comment Share on other sites More sharing options...
gebeer Posted December 1, 2013 Share Posted December 1, 2013 I think for number 2 you need the $page->render() function. On the API Cheatsheet it says: Returns rendered page markup. echo $page->render(); 1 Link to comment Share on other sites More sharing options...
titanium Posted December 2, 2013 Share Posted December 2, 2013 The section (subpage) shouldn't be directly accessible by URL, should return 404 not found instead. Looks like setting status to unpublished will work, is this the only option? I think you need something like this (direct page access redirects to the parent page): if ($_SERVER['SCRIPT_URL'] === $page->url) { $session->redirect($page->parent->url); exit; } alternatively, if you would like to show a 404: if ($_SERVER['SCRIPT_URL'] === $page->url) { throw new Wire404Exception(); exit; } 2 Link to comment Share on other sites More sharing options...
diogo Posted December 2, 2013 Share Posted December 2, 2013 There you have it, geeber and titanium just answered to the missing points. Building on top of that, your homepage code wouldn't be too different from this: <?php // header code foreach ($page->children() as $child) $child->render(); // footer code Couldn't get much simpler than this, could it? edit: titanium's method is perfectly fine, but if you're using the dev version you can use the method that Ryan describes here http://processwire.com/talk/topic/3551-small-tip-for-pages-that-will-be-used-with-render/ 2 Link to comment Share on other sites More sharing options...
processwirefan Posted December 3, 2013 Author Share Posted December 3, 2013 Thank you Gebeer, Titanium, and Diogo for pointing me to the right direction, will definitely try those solutions out. Have a great day! David Link to comment Share on other sites More sharing options...
SamC Posted January 14, 2017 Share Posted January 14, 2017 On 02/12/2013 at 9:59 AM, titanium said: I think you need something like this (direct page access redirects to the parent page): if ($_SERVER['SCRIPT_URL'] === $page->url) { $session->redirect($page->parent->url); exit; } alternatively, if you would like to show a 404: if ($_SERVER['SCRIPT_URL'] === $page->url) { throw new Wire404Exception(); exit; } Totally just needed this, thanks 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now