MadeMyDay Posted September 9, 2014 Author Share Posted September 9, 2014 You have to define the title field globally as not required (field settings). Otherwise the page doesn't get published. What PageTable (and so also the extended version) does, is to display the autoformat title instead of the title field. The field itself remains required as long as you don't define it otherwise. Would you also can try to do (haven't tried it myself yet): Define the field as not global, so you don't need to add it to your PageTable templates. Link to comment Share on other sites More sharing options...
Soma Posted September 9, 2014 Share Posted September 9, 2014 Just to add to the confusion. - You can make the title field not required in template context. - You can set a template to not include global fields (advanced settings) So you could remove title for that template but still have title global. 7 Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 9, 2014 Author Share Posted September 9, 2014 Just to add to the confusion. - You can make the title field not required in template context. - You can set a template to not include global fields (advanced settings) So you could remove title for that template but still have title global. So this seems to be the safest way, thx Soma! Link to comment Share on other sites More sharing options...
thistimj Posted September 9, 2014 Share Posted September 9, 2014 @MadeMyDay, unchecking the Global box on the title field worked. @Soma's advice also worked. I unchecked "Required" for the template's title and changed the "Visibility" to hidden. Worked like a charm. Thank you! Link to comment Share on other sites More sharing options...
titanium Posted September 11, 2014 Share Posted September 11, 2014 Really awesome module, MadeMyDay! I'm using some kind of template delegate approach (template has an alternative template filename set - "router.php" - which controls the inclusion of the "real" templates in a MVC way. These templates reside in subfolder "controllers".) In order to make it work, I had to change line 45 from $parsedTemplate = new TemplateFile($this->config->paths->templates . $p->template->name . ".php"); to $parsedTemplate = new TemplateFile($this->config->paths->templates . '/controllers/' . $p->template->name . ".php"); Maybe you have a better idea for people like me who use alternative template paths? Using my way, I always have to manually update the module file, if it get's updated by you. Another question: how does the module deal with unpublished PageTable (sub)pages (the "blocks" inside the PageTable)? They are not handled different to published pages, are they? I think I would like to get them rendered with an extra css class around it - this way the content could be especially marked or hidden by CSS. (I guess this could also be done on template level, but it's not convenient that much.) 1 Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 12, 2014 Author Share Posted September 12, 2014 Maybe you have a better idea for people like me who use alternative template paths? Using my way, I always have to manually update the module file, if it get's updated by you. Will make the path configurable. Another question: how does the module deal with unpublished PageTable (sub)pages (the "blocks" inside the PageTable)? They are not handled different to published pages, are they? I think I would like to get them rendered with an extra css class around it - this way the content could be especially marked or hidden by CSS. (I guess this could also be done on template level, but it's not convenient that much.) I have an idea, will implement it asap. How does this sound: Additional CSS classes for unpublished, hidden, locked. And additionally a setting if unpublished blocks should be rendered collapsed or if all blocks always should be open. Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 12, 2014 Author Share Posted September 12, 2014 Pushed an update to the module: New settings: Path to TemplatesIf you use a delegated template approach, please provide your path to the templates (relative to templates directory). Collapse unpublished rowsIf checked, unpublished PageTable parts are rendered collapsed and can be opened on click. (hidden) CSS classes for PageTable page statusThe rendered parts (the div.renderedLayout) get the status of the page as CSS class: ".pte-hidden" for hidden pages ".pte-unpublished" for unpublished pages ".pte-locked" for locked pages @titanium: Could you please test the new version (0.2.0.) with your template delegate approach. I don't use it, so I can't test it quickly. But should work 7 Link to comment Share on other sites More sharing options...
titanium Posted September 15, 2014 Share Posted September 15, 2014 @titanium: Could you please test the new version (0.2.0.) with your template delegate approach. I don't use it, so I can't test it quickly. But should work You're welcome! I did test it, and it works great! Only one small glitch - one of the help text says: "For example "/controllers/"". I think it should be corrected to "For example "controllers/", because the first front slash is already part of $this->config->paths->templates. This module contributes great value to ProcessWire and I nominate it as Module Of The Year Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 15, 2014 Author Share Posted September 15, 2014 Only one small glitch - one of the help text says: "For example "/controllers/"". I think it should be corrected to "For example "controllers/", because the first front slash is already part of $this->config->paths->templates. fixed, thx. This module contributes great value to ProcessWire and I nominate it as Module Of The Year And I nominate PageTable itself, without that it wouldn't be possible But thank you very much Link to comment Share on other sites More sharing options...
videokid Posted September 19, 2014 Share Posted September 19, 2014 Just to add to the confusion. - You can set a template to not include global fields (advanced settings) So you could remove title for that template but still have title global. Really? I have a template called 'options' but I can't find that in the 'advanced' tab [using 2.5.1 dev] Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 22, 2014 Share Posted September 22, 2014 (edited) It looks like that OutputFormatting is off when you open a page with that contains a PageTableExtended field. After editing a 'page' and closing the modal, OutputFormatting kicks in and the page renders as expected. Is there a way to enable OutputFormatting right away? Oké, I should not complain When I add OutputFormatting to the page at line at line 52 it looks like it resolves the issue: //InputfieldPageTableExtended.module $parsedTemplate->page->of(true); (Made a pull request on github) Edited September 22, 2014 by Martijn Geerts Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 22, 2014 Author Share Posted September 22, 2014 I'd gladly accept the pull request. But I totally don't understand why output formatting is off in the first place. Some general admin thing? Would make sense, but then I think it wouldn't be the best idea to simply turn it on. Perhaps there is a reason for setting it to off? Does anyone know why? Btw: I am thinking of building a version where the rows get rendered in an Iframe (pretty much like Form Builder does), so we have a more sandboxed solution. Not quite sure about the additional work needed though. 1 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 22, 2014 Share Posted September 22, 2014 Can't help you with your questions. ps, I would love to see the the iframed one, so +1 for the sandboxed. Link to comment Share on other sites More sharing options...
Beluga Posted September 23, 2014 Share Posted September 23, 2014 I'd gladly accept the pull request. But I totally don't understand why output formatting is off in the first place. Some general admin thing? Would make sense, but then I think it wouldn't be the best idea to simply turn it on. Perhaps there is a reason for setting it to off? Does anyone know why? Adrian noticed the same thing recently. 1 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 23, 2014 Share Posted September 23, 2014 Actually, you don't turn it on for the admin, but for the specific page getting rendered. Untill now I don't see any negative side effects. Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 23, 2014 Author Share Posted September 23, 2014 I just merged the two PRs, don't see any side effects. But decided to turn off of after rendering just in case... (btw: I think I didn't procede the PRs correctly, merged a lot in circles, sorry for that ) Link to comment Share on other sites More sharing options...
Soma Posted September 23, 2014 Share Posted September 23, 2014 Output formatting is off because we are in the back-end. Pages loaded in any a module have it off, it's only on in front-end context. All normal, and no problem turning it on if needed. 3 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 23, 2014 Share Posted September 23, 2014 I'm no git hero... I tend to mess it up for my repositories all the time. Tnx for the update. Link to comment Share on other sites More sharing options...
Thomas108 Posted September 30, 2014 Share Posted September 30, 2014 Hi, first of all thanks for this great module. Unfortunately I can't get it to work as expected. I must admit that I just recently built my first website with pw and I haven`t even had a look at how the PageTable Module works.I use PW 2.5.3 dev and I installed PageTable and PageTableExtended modules.I created two templates with template files that contain the part template code from MadeMyDay on page one of this thread (plus my fields): <?php $headline1 = ""; $headline2 = ""; if(!$page->checkbox1) $headline1 = "<h2>{$page->title}</h2>"; if(!$page->checkbox2) $headline2 = "<h2>{$page->text1}</h2>"; // Output echo " <div class='pageTableSection {$page->template->name}'> <div class='inner'> <div class='col one-half'> {$headline1} {$page->body} {$image_1} // my image field 1 {$textblock_1} // my text field </div> <div class='col one-half'> {$headline2} {$page->textarea1} {$image_2} // my image field 2 {$textblock_1} // my text field </div> </div> </div> "; Then I created one image field and one Textfield and assigned them to my part templates. After this I created one PageTableExtendedField and selected my 2 part templates under the details tab and title,Image_1 and textblock_1 under the Input tab as table fields to display in admin.I checked: Render Layout instead of table rowsI didn't put any stylesheet yet.In my basic-page.php I pasted this part: <?php $bodyclass='inner'; $content = "{$page->body}"; if(count($page->layout)>0){ foreach($page->layout as $l){ $content .= $l->render(); } } What I am getting now in the backend is an error: Error: Call to a member function of() on a non-object (line 101 of /home/home1007/public_html/pw/site/modules/FieldtypePageTableExtended/InputfieldPageTableExtended.module) I outcommented line 101: // $parsedTemplate->page->of(false); // set OutputFormatting back to false, just in case Now I saw my part_templates as two buttons only in the backend. After I expanded them I could enter title and name. I did this and then I was also able to enter an image and some text. Now it looks like this, both fields have an image, and some text, but in the layout elements only the titles are displayed: Only when I press the edit button on the right side, I can see my image and my Text.Also the two buttons remain on the bottom. (Don't know if this should look like this) Obviously I did something wrong, but I couldn't find any more precise instruction for either PageTable or PageTableExtended. Please bear with me, I still got a lot to learn and I would be very happy if someone could tell what I did wrong or what I have to do more to set set this up properly. Regards, Thomas Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 30, 2014 Author Share Posted September 30, 2014 Sorry, I am in a hurry, but two things: {$image_1} // my image field 1 should be {$image_1->url} // my image field 1 Also the two buttons remain on the bottom. (Don't know if this should look like this) Yes, the buttons are always at the bottom (like in PageTable itself). Because of the backend error you got first: I have to take a deeper look. Thx for reporting! Link to comment Share on other sites More sharing options...
Thomas108 Posted September 30, 2014 Share Posted September 30, 2014 @mademyday: Thanks for your help I changed my code to: {$image_1->url} // my image field 1 still my images are not visible in the layout elements. But I just realized that I could revert InputfieldPageTableExtended.module to it's original state without getting an error. (And it had nothing to do with my false image call) I really don't know what I did to make the error dissapear, but it's gone. Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 30, 2014 Author Share Posted September 30, 2014 Sorry, my fault. By default the image object returns an array of images, so if you want to have the url of the first image you have to do this: {$image_1->eq(0)->url} // my image field 1 I really don't know what I did to make the error dissapear, but it's gone. I assume you got this error while there wasn't any template to be rendered or you got an error which prevented the template from being rendered and then caused this follow-up error. Link to comment Share on other sites More sharing options...
Thomas108 Posted October 1, 2014 Share Posted October 1, 2014 hhm, that gives me an Error: Error: Call to a member function eq() on a non-object (line 17 of /home/home1007/public_html/pw/site/templates/part_tpl_1.php) Link to comment Share on other sites More sharing options...
MadeMyDay Posted October 1, 2014 Author Share Posted October 1, 2014 Well, it depends on how you configured the image field. If it is set to hold multiple images you get the url of the first image with: $myImageField->eq(0)->url Otherwise, if you set the image object to only allow one image, then you get the url of the image like this: $myImageField->url Either way, this just the url. For outputting the image in the template you have to wrap it in an image tag like so: <img src='{$myImageField->url}' alt=''> 1 Link to comment Share on other sites More sharing options...
Thomas108 Posted October 1, 2014 Share Posted October 1, 2014 Sorry, but I think I did that right. Well now I allowed only one image in my image field and keep using $myImageField->url at least I have no errors. Do I maybe have to put the image url in a variable? <?php $headline1 = ""; $headline2 = ""; $image = $image_1->url; //my trial with a variable didn't work if(!$page->checkbox1) $headline1 = "<h2>{$page->title}</h2>"; if(!$page->checkbox2) $headline2 = "<h2>{$page->text1}</h2>"; echo " <div class='pageTableSection {$page->template->name}'> <div class='inner'> <div class='col one-half'> {$headline1} {$page->body} {$image} // before trying the variable thing I had here: {$image_1->url;} {$textblock_1} </div> </div> </div> "; Anyhow, from this code with or without the commented changes I am getting this markup in my layout field in the admin: <div class="pageTableSection part_tpl_1"> <div class="inner"> <div class="col one-half"> <h2>wtf</h2> </div> </div> </div> Only {headline} gets outputted. Guess I am doing something really wrong here. 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