Jump to content

MadeMyDay

Members
  • Posts

    371
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by MadeMyDay

  1. +1 for drafts. In my opionion the "save unpublished" feature is great and for my (and my client's) needs it would be totally sufficient to have a possibility to save existing (and published) pages as a draft. Like "save and preview" or "save as draft". So the latest published version keeps being online and the new one is saved until someone hits "save and publish". Perhaps the same functionality could be achieved with using the cache. So if cache is enabled and the new version (the draft) is saved, it would be totally enough (for me) to not empty the cache until "publish" is hit. So perhaps a module which hooks into the cache management and displays an additional button "save draft" which saves the page but doesn't empty the cache. The editor can easily preview his changes because he is logged in. Guest still see the old version. Since we are here talking about wishes: My number one wish is a (real) multisite capability. Something like contexts in MODX with customizable settings for each context (domain, templates whatsoever). The multisite module works pretty well, but it would be nice to have something like this a bit more robust with something like $context->config->host.
  2. Hi Tobaco, my setup is always the same. Doesn't matter if I use PageTable or not. Here it goes (simplified): /templates - basic-page.php - home.php - /tpl - main.php - mainnav.php - subnav.php - footer.php The tpl/main.php is the overall template like: <?php include('tpl/mainnav.php'); include('tpl/subnav.php'); include('tpl/slider.php'); ?> <!DOCTYPE html> <html class="no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title><?= $page->title ?></title> <!--- styles and scripts --> </head> <body class='<?= $bodyclass ?>'> <header> <div class='wrap'> <a href="/"><img src='/site/templates/img/logo.png' class='logo' alt="Logo"></a> <nav class='main'> <?= $mainnav ?> </nav> </div> </header> <?= $slider ?> <?= $subnav ?> <section class="content"> <div class="wrap group"> <h1 class='v2 hide'><span><?= $page->title ?></span></h1> <?= $content ?> </div> </section> <footer> <div class="group"> <?php include ('tpl/footer.php'); ?> </div> </footer> <script src="/site/templates/dist/all.min.js"></script> </body> </html> basic-page template looks like this (every template renders the content and then includes the main template): <?php /** * basic page template * */ $bodyclass='inner'; $content = $page->body; include('tpl/main.php'); With PageTable the structure looks like this: /templates - basic-page.php - home.php - part_text.php - part_columns.php - part_gallery.php - /tpl - main.php - mainnav.php - subnav.php - footer.php The part_* templates are templates only for PageTable. part_columns.php could look like this: <?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} </div> <div class='col one-half'> {$headline2} {$page->textarea1} </div> </div> </div> "; And the basic page template gets enhanced by ("layout" being the PageTableExtend field): <?php /** * basic page template * including PageTable layout parts */ $bodyclass='inner'; $content = "{$page->body}"; if(count($page->layout)>0){ foreach($page->layout as $l){ $content .= $l->render(); } } include('tpl/main.php'); That way, the layout parts are easily renderable in the Admin with PageTableExtended. While writing this, I want to point to another feature of the module. If rendered by PageTableExtended, the template gets an option 'pageTableExtended' which you can use in your part template: // Output echo " <div class='pageTableSection {$page->template->name}'> <div class='inner'> <div class='col one-half'> {$headline1} {$page->body} </div> <div class='col one-half'> {$headline2} {$page->textarea1} </div> </div> </div> "; if(!$options['pageTableExtended']){ // we are not in the Admin, so we include our social media buttons which we only need in our frontend include('social/socialmediabuttons.php); } Hope that helps.
  3. Yes. But the src should be altered by the polyfill before loading it. That's the reason why the JS should be placed in the <head>. Haven't used the v2 of the polyfill yet since v1 works pretty well. As long as the element's distribution in current browsers isn't given, I'll stick with it. Okay, honestly: I stick with it because I have written a jQuery plugin that relies on the <img>-version
  4. Sure? The polyfill is loaded first and alters the src according to the matched media query before any image is actually downloaded. You can easily prove that when looking at the network tab in chrome dev tools.
  5. Added instructions for altering template output when called from PageTableExtended.
  6. Hi Yesjoar, Okay, I pushed an update to GitHub. The dependencies of the modules were not clear and the titles misleading. Please try to override the modules with the new ones.
  7. Manfred, just wanted to say a huge THANK YOU for your effort! Very appreciated!
  8. I totally agree. I was waiting for a configurable repeater (with different templates to choose from) for ages. Now PageTable has this feature, so I went with this But hey, never say never. Question is... When do you want to save the changes? Autosave? No good idea as long there are no draft versions. So this is getting complicated. Either you provide a save button on each row (easy to implement, but hard to understand for editors) or you save the entries on page save (easier to understand but harder to implement). You then would have to monitor the changed fields, look for their page, save the fields on each page... well.
  9. I am a bit ambivalent regarding such a feature. Of course it would be nice, but also would add a lot of overhead to this specific module. If there would be an existing solution for that (for the frontend), it would be easy to integrate it as well in this module (including necessary js and css files should be enough), because the layouts are rendered as in the frontend.
  10. There is no drawback, there are only advantages. For example if an instructor changes, you only change the reference, you don't have to give the course a new place in the tree (and lose perhaps the URL).
  11. Yep, exactly what Sinnut says. And the best part: You also can import the courses with the CSV importer. Just define a page field in the course template which relates to the instructor(s). You can easily customize the CSV importer module for that case. For example a reference to instructors with ids 1012,1024,1034 should be placed in a column in the CSV export which then is tied to the page field. Of course the ids don't match "the old" ones, so you have to apply some additional logic in the importer. For example it could be possible to import the old id with the instructors in an extra field and while importing the courses you look for the matching instructor and build the relation via the page field. Search the forums a bit, especially the CSV import thread, there are a lot of good solutions hidden
  12. PageTableExtended Download here: http://modules.processwire.com/modules/fieldtype-page-table-extended/ Extends the Processwire PageTable field for rendering table row layouts. This is great for editors, because they actually see at a glance what the table rows consist of. What it does Turns the Processwire Fieldtype "Page Table" from this: into something like this (sorting capabilities of course still functional): See it in action: Requirements FieldtypePageTable installed (part of the core since Processwire 2.4.10.) Templates used for PageTable need a file associated (otherwise nothing gets rendered) This render method is meant for sites where the PageTable templates only render part of the layout, not complete websites. But you also can define what will be rendered (see below). Options Render Layout instead of table rows Check this for seeing the rows rendered. You can easily turn off the complete functionality by unchecking this. Path to Stylesheet Since the parts are unstyled by default, it is a good idea to define styles for them. All rendered templates are encapsulated in a div with the class "renderedLayout" so you can style them with: div.renderedLayout h2{ color: green; } The path is to be set relative to your templates' folder. Reset Admin CSS Since the parts are rendered inside the Admin, common styles of the Admin Interface apply also to your layout parts. This is not a bad thing, because especially text styles are well integrated in your admin's theme. But if you like to override the admin styles in your table rows completely (more or less), just check this box. Don't forget to define a custom CSS then! Advanced Since this module is meant for parts of your layout you already have defined for your frontend templates, it is a good idea to use a preprocessor like Stylus, Sass or Less for building the custom CSS file. Just outsource your layout part definitions in an extra file, compile that in a separete CSS file and use this as custom CSS for this module. Since your CSS is should be built in a modular way, this works pretty well ;-) Will write a tutorial with a use case once finished testing. Notes: Github: https://github.com/MadeMyDay/PageTableExtended If you want to get rid of the unnecessary step for entering a title before editing the page, just set the "autoformat" value as suggested in the PageTable settings. If you don't want to use a title field at all, see this post from Soma Will put it in the module repository once finished testing. Please test it and give feedback. I haven't used GitHub for a long time, please check if everything is in place and if this will work with the modules manager and the new core module installer once added to the repository. Have fun Module is in the repository now: http://modules.processwire.com/modules/fieldtype-page-table-extended/ Please use GitHub for instructions, I made some additions there.
  13. How are they related in your original database? Do you have instructors and reference the courses or do you have courses and reference the instructors?
  14. Getting there Will try to finish a first version tomorrow. Basically same function as PageTable but with the option to render the parts for a better visual interface for editors.
  15. Yeah, me too (Skills are very limited, but I WANT THIS)
  16. Perhaps because I obviously don't know what I am doing Hooking only makes sense for events, extending for altering methods, right? I think I got it (say, a little more) Thanks Soma!
  17. Yeah, Soma, thx! Had parent:init(), but didn't know I have to define the new values. So solution is: public function init() { parent::init(); $this->set('pathToCSS', ''); $this->set('renderLayout', ''); } Now the tricky part begins Perhaps you can help me: I want to hook into a (hookable) method from the InputfieldPageTable module. I try this: public function init() { parent::init(); $this->set('pathToCSS', ''); $this->set('renderLayout', ''); $this->addHook('InputfieldPageTable::renderTable', $this, 'hookRenderTable'); } with protected function hookRenderTable(HookEvent $event) { // do something } I figured for example that $event->return is the original return of the parent module. Is there some overview which other arguments are "hidden" in $event. Var_dump is so huge, I can't find the values I'm looking for (in this case the id of the page, which is rendered in the table row).
  18. I am trying to develop a module which extends the great new pageTable module. This module consists of two modules, the FieldtypePageTable and the InputfieldPageTable module, which themselves extend the FieldtypeMulti module and the Inputfield module. I am now trying to extend both of them, but I can't get access to my configuration of the Inputfield. Also I have a general question about the architecture and how those modules interact. The configuration of the Fieldtype module (shortened): public function ___getConfigInputfields(Field $field) { $inputfields = parent::___getConfigInputfields($field); $f = $this->wire('modules')->get('InputfieldText'); $f->attr('name', 'sortfields'); $f->label = $this->_('Sort fields'); $f->description = $this->_('Enter the field name that you want your table to sort by. For a descending sort, precede the field name with a hyphen, i.e. "-date" rather than "date".'); // sort description 1 $f->description .= ' ' . $this->_('You may specify multiple sort fields by separating each with a comma, i.e. "last_name, first_name, -birthday".'); // sort description 2 $f->notes = $this->_('Leave this blank for manual drag-and-drop sorting (default).'); $f->collapsed = Inputfield::collapsedBlank; $f->attr('value', $field->sortfields); $inputfields->add($f); return $inputfields; } InputfieldPageTable: public function ___getConfigInputfields() { $inputfields = parent::___getConfigInputfields(); $f = $this->wire('modules')->get('InputfieldTextarea'); $f->attr('name', 'columns'); $f->label = $this->_('Table fields to display in admin'); $f->description = $this->_('Enter the names of the fields (1 per line) that you want to display as columns in the table. To specify a column width for the field, specify "field_name=30" where "30" is the width (in percent) of the column. When specifying widths, make the total of all columns add up to 100.'); // Columns description $f->notes = $this->_('You may specify any native or custom field. You may also use subfields (field.subfield) with fields that contain multiple properties, like page references.') . ' '; // Columns notes $columns = $this->columns ? $this->columns : $this->getConfigDefaultColumns(); $f->attr('value', $columns); return $inputfields; First question: Why is this different? FieldtypePageTable references $field, whereas the InputfieldPageTable doesn't and uses $this->setting. When I try to extend the configuration options in the Inputfield like this: public function ___getConfigInputfields() { $inputfields = parent::___getConfigInputfields(); $f = $this->wire('modules')->get('InputfieldCheckbox'); $f->attr('name', 'renderLayout'); $f->attr('value', 1); //$f->attr('checked', 'checked'); if($this->renderLayout) $f->attr('checked', 'checked'); $f->label = $this->_('Render Layout instead of table rows?'); $f->description = $this->_('If checked, layout is rendered instead of table row.'); // renderLayout option description $f->notes = $this->_('Make sure that your PageTable templates render only html fragments and not complete websites.'); //$f->collapsed = Inputfield::collapsedBlank; $inputfields->add($f); $f = $this->wire('modules')->get('InputfieldText'); $f->attr('name', 'pathToCSS'); $f->attr('value', $this->pathToCSS); $f->label = $this->_('Path to Stylesheet'); $f->description = $this->_('Custom CSS to include for styling pageTable entries in Admin.'); // page name format description $f->notes = $this->_('More information to follow.'); // page name format notes $inputfields->add($f); return $inputfields; } I can see the options in the field configuration and after save I can see the settings in the field's database row: But the configs are empty again after save: Obviously the $f->attr('value', $this->pathToCSS) part is not correct. But how do I access the value in my module? In other modules this seems to be the way to go... If I try to extend the Fieldtype module's configuration, I can access the value with $field->mysetting, but here I want to extend the Inputfield and it doesn't work. Thanks in advance!
  19. Well, it works at least in my environment. But I only need to include the content of one page now and then. It seems that you want to copy the original content 1:1?
  20. Perhaps a screenshot would help with annotations which page should display what and how they are related. Also the complete code of your template would help. Also: perhaps start a new thread, because this is pretty specific and this thread is getting longer and longer .
  21. Well you just override the current page. If there are children involved you have to define those children before switching the page object. Otherwise children are empty.
  22. Well, your function also should work like this (assuming it is defined in your template): function sponsor_row($group) { foreach($page->sponsors as $sponsor) { if ($sponsor->sponsor_group->title == $group) { $output .= … } } return $output; } Otherwise I need to know the environment. You also could handle over the $page object: $outMain .= sponsor_row('Major Club Partners',$page); function sponsor_row($group, $page) { foreach($page->sponsors as $sponsor) { if ($sponsor->sponsor_group->title == $group) { $output .= … } } return $output; }
  23. Do you have an example? If you use them in your template there is no need for wire(). Just use $page. If you are using custom modules for your site, I am not sure. Just show your example and I will check it.
×
×
  • Create New...