-
Posts
848 -
Joined
-
Last visited
-
Days Won
4
Everything posted by mr-fan
-
Next little tutorial on this really great module... Getting a Footermenu stripped from the mainmenu and output in a footermenu 1. Setup Pagefield for your /settings/ or /tools/ page This solution could be set by the user direct via a simple pagefield to select normal contentpages that a normaly in the mainmenu...but this items should stay not there and render somewhere else... 2. Strip the choosen pages from the mainmenu //get the pagefield content $footerMenu = $settings->footer_menu; //just the needed option listed - other options like needed for your menu $options = array( 'selector' => 'id!='.$footerMenu.'', // define custom PW selector ); 3. Output the pagefield items <?php //in my example i am in the _main.php template and render some footermenu if ($settings->footer_menu) { //check for the pagefield echo '<div class="eight columns">'; foreach ($settings->footer_menu as $item) { if (!$item->is('hidden') || $item->is('unpublished')) { //check for hidden/unpublished pages!! echo '<a href="'.$item->url.'" class="button sendbtn btnSend">'.$item->title.'</a>'; } } echo '</div>'; } ?> hope this is helpful...have fun. I don't have a blog and i am a fan of keeping things together....so don't bother if i'm posting such things here and write me if such usecases are not helpful or nonsense...... Best regards mr-fan
-
Help getting started with textformatters
mr-fan replied to mr-fan's topic in Module/Plugin Development
Thank you Sinnut...This is a great tutorial! Best regards mr-fan -
Hi i'm testing some things with textformatters. I did buy profields to get autolink as a learning base but this seems to be to complicated for me/my skills. So like always i try to start from the basics...so like often i'm stucked just created a easy textformatter that does some replacement on special tags - i looked at some other textformatters before i setuo this. My Question is how i could debug such things within a textformatter i only get PHP errors but how could i test the output. Is there any better commented example or explanation/docs on this topic? What i need is to search textfields for special tags that start with || and end with || could be a word or phrase like ||example|| or ||other example|| - i wanna replace the inner string complete... what i've until now is: /** * For the Textformatter interface * */ public function format(&$str) { $openTag = '\|\|'; $closeTag = '\|\|'; $matches = array(); $general_pattern = sprintf('/%s(.*?)%s/', $openTag, $closeTag); preg_match_all($general_pattern, $str, $matches); foreach ($matches[1] as $match) { //wanna replace the whole tag ||test|| should be only test $search = $openTag.$match.$closeTag; //don't work like expected $str = str_replace($search, "test", $str); //works the part inside the tags are changed ||test|| on every match //$str = str_replace($match, "test", $str); //works for testing show all matches are correct after the textfield output $str .= $match.' '; } } any hint in the right directions would be great. Best regards mr-fan
-
PW dev 2.6.13 - CKE is not loaded correct to the texarea? May it is a special thing i use a other skin on CKE https://github.com/NicoKnoll/LightWire-Skin Big thank you for this module - it's a very nice addition for superusers to get a better overview on big websites with many editors/users. Best regards mr-fan
-
OK i figured it out while reducing the options.... so this wont work: $fredi->setText("Edit")->hideTabs("children|delete|settings|history")->renderAll($e); while this works: $fredi->setText("Edit")->hideTabs("children|delete|settings")->renderAll($e); it was the history tab that cases the no-data-saved problem. This tab is generated from the version control module....so i will have to take a look into hiding this tab somewhere else or change fredi. so this is solved - sorry for fast posting before better researching... Best regards mr-fan
-
i forgot a nice to know. the first renderFredi link on the whole page don't save simple changed on the events page, too! so every fredi link get's renders correct - but no one seems to save the changes...so not only the links on the different events don't work the fredi link that works on all other pages like it should didn't work on this page where i've more than one fredi link....
-
Could there be a problem if i call fredi more than once on a page? PW dev 2.6.13 - debug mode on - actual fredi on all templates i use fredi for the whole page like this: <?php //in <head> if($page->editable() && $user->isLoggedin()) { echo $fredi->renderScript(); } ?> <?php //in <body> if($page->editable() && $user->isLoggedin()) { echo $fredi->setText("Edit")->hideTabs("children|delete|settings|history")->renderAll(); } ?> and in one template where i render events - i want to edit the single events - and since i have no "single-event-view" and only the "events" page i've tryed to render Fredi within the loop on every event item like this: //get all events and render list - events is set in events.php foreach ($events as $e) { //some markup and vars.... //create event html output echo '<article class="tline-box '.$class.'"> <span class="'.$span.'"></span><br>'; //if editable show editlink to the event page if($page->editable() && $user->isLoggedin()) { echo $fredi->setText("Edit")->hideTabs("children|delete|settings|history")->renderAll($e); } //rest of markup.... and it works like it should so far - but it doesn't save the changes? - generated link points to the right page_id's - popup edit modal shows the right entry - could easy edit all things but at the end the event isn't changed - no error - no hint? wrong token, id, pageobject i've no glue? Best regards mr-fan
-
Always depending on the project/strucure/needs but this sounds very much...i'm just building a huge website and stay with ~15 templates and about 30 fields...with many PageTable templates as partial blocks, seo fields, advanced kind of blog with settings and additonal stuff like "see_also" Pagefields and so on, own contact form, some widgets.... You should think about reusing fields in context of a template and may using URL segments to get less single templates. For example on a blog i usually don't need extra templates for things like /my-blog/archive/ or /my-blog/tagoverview/ - this all happens in one template using URL Segments... Or is this a whole Webapp with some special kind of content, user interaction, intranet or something else? regards mr-fan
-
Some Additions. 5. using PageTable and pages for repeating items Pros: more userfriendly than repeaters and working with pages since everthing is a page Cons: no easy setup, more fields 6. using ProFields - Multiplier and Textareas Pros: less fields Cons: You have to buy ProFields 7. Combining ProFields with PageTable to have a Config Page for this kind of things... Pros: very userfriendly, less fields Cons: You have to buy ProFields ....at least some address fields, or footerlinks don't challenge your resources to much i think...so it's your choice on the best usability i think! regards mr-fan
-
MarkupSEO - The all-in-one SEO solution for ProcessWire.
mr-fan replied to Nico Knoll's topic in Modules/Plugins
Gebeer you could try to set them - i do that with a custom script to get seo fields prefilled on publishing if users don't fill seo fields manually. example: //set seo_title on publishing $page->set ('seo_keywords', $default_keywords); //set seo_description on publishing $page->set ('seo_description', $default_desc); ... set should work for you. best regards mr-fan -
if you take my example from above you could strip it to the minimal setup like this: //topMenuNav $rootPage = $page->get('/'); //shows current tree $topMenu = $modules->get("MarkupSimpleNavigation"); // load the module // hook to have custom items markup $topMenu->addHookAfter('getTagsString', null, 'customNavItems'); function customNavItems(HookEvent $event){ $item = $event->arguments('page'); //if the item id is 1068 do something if($item->id == 1068){ //build the normal li item output or change the item with id 1068 to your needs //add new items that aren't in the normal pagetree or add megamenu items //....do what you want! $out = '<a href="'.$item->get("url").'">'.$item->get("title|name").'</a>'; $event->return = $out; } } //setup $options for the normal markup and render the nav... so you could get every special item you need and change it. best regards mr-fan
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
mr-fan replied to kongondo's topic in Modules/Plugins
There are many usefull situations like: 1. If you have a page for settings or tools with general entries/items and you use them on other pages like in a contactform you use the email field from the /settings/ page you could show this general fields on several places/templates 2. more advanced example could be to render statistic like content from subpages - imagine if you have a ad system that is counting views and clicks you could render a little stat with some html and some css/js at the rootpage of the ad's... 3. special for overview pages/rootpages it provides options to put some extra information/logic in such pages without the use of pagetable or something other complex.. 4.... you get the idea regards mr-fan -
Sorry little late at the party but like i wrote a little how to use MSN for a megamenu or add any other items between items... this should be the result - some li item with extra div content with latest/top article and some other items in this example from a pagefield/categories.... Code ist hopefully well commented... //topMenuNav $rootPage = $page->get('/'); //shows current tree $topMenu = $modules->get("MarkupSimpleNavigation"); // load the module // hook to have custom items markup $topMenu->addHookAfter('getTagsString', null, 'customNavItems'); function customNavItems(HookEvent $event){ $item = $event->arguments('page'); // get the article mainnav item and add some megamenu items... if($item->id == 1068){ //build the normal li item output $out = '<a href="'.$item->get("url").'">'.$item->get("title|name").'</a>'; //get the last article $top_article = wire('pages')->find("template=artikel,top_thema=1,sort=-publish_from")->first(); //get the last article $latest_article = wire('pages')->find("template=artikel,sort=-publish_from")->first(); //get image thumb from $top_article //get the original image $imagetop = $top_article->get("artikel_bild"); // get the image instance of the cropped version of "artikel" 750px wide $thumbtop = $top_article->artikel_bild->getCrop('Artikel'); //get image thumb from $latest_article //get the original image $imagelatest = $latest_article->get("artikel_bild"); // get the image instance of the cropped version of "artikel" 750px wide $thumblatest = $latest_article->artikel_bild->getCrop('Artikel'); //get the items for the tagmenu $cat_items = wire('pages')->find("template=artikel_cat"); //get the rootpage of the posts $artikel_root = wire('pages')->get(1068); //homepageurl $homepageurl = wire('pages')->get('/')->httpUrl; //start megamenu $out .= '<ul class="mega">'; //first column last "top" marked article $out .= '<div class="one_third"><h4 class="subtitle">Top Aktuell</h4>'; $out .= '<a class="mega-link-img" href="'.$top_article->get("url").'"><img src="'.$thumbtop->url.'" alt="'.$thumbtop->description.'"><br></a>'; $out .= '<h6><strong>'.$top_article->get("headline").'</strong></h6>'; $out .= '<p>'.$top_article->get("shorttext").'</p>'; $out .= '</div>'; //second column - latest article $out .= '<div class="one_third"><h4 class="subtitle">Letzter Artikel</h4>'; $out .= '<a class="mega-link-img" href="'.$latest_article->get("url").'"><img src="'.$thumblatest->url.'" alt="'.$thumblatest->description.'"><br></a>'; $out .= '<h6><strong>'.$latest_article->get("headline").'</strong></h6>'; $out .= '<p>'.$latest_article->get("shorttext").'</p>'; $out .= '</div>'; //third column - list of tags (links to URL segments on artikel_stamm template) $out .= '<div class="one_third"><h4 class="subtitle">Themenbereiche</h4>'; foreach ($cat_items as $cat) { $out .= '<li><a href="'.$homepageurl.$artikel_root->name.'/'.$cat->name.'/">'.$cat->title.'</a></li>'; } $out .= '</div>'; //close megamenu $out .= '</ul>'; $event->return = $out; } } $options = array( 'parent_class' => 'parent', // overwrite class name for current parent levels 'current_class' => 'current', // overwrite current class 'has_children_class' => 'has_children', // overwrite class name for entries with children 'levels' => true, // wether to output "level-1, level-2, ..." as css class in links 'levels_prefix' => '', // prefix string that will be used for level class 'max_levels' => 3, // set the max level rendered 'firstlast' => false, // puts last,first class to link items 'collapsed' => false, // if you want to auto-collapse the tree you set this to true 'show_root' => false, // set this to true if you want to rootPage to get prepended to the menu 'selector' => 'template!=artikel|event', // define custom PW selector, you may sanitize values from user input 'selector_field' => 'nav_selector', // string (default 'nav_selector') define custom PW selector by using a property or field on a page. Use this setting if you want to overwrite the default nav_selector 'outer_tpl' => '<ul id="nav" class="sixteen columns">||</ul>', // template string for the outer most wrapper. || will contain entries 'inner_tpl' => '<ul>||</ul>', // template string for inner wrappers. || will contain entries //'list_tpl' => '', // template string for the items. || will contain entries, %s will replaced with class="..." string 'list_field_class' => '', // string (default '') add custom classes to each list_tpl using tags like {field} i.e. {template} p_{id} 'item_tpl' => '<a href="{url}">{title}</a>', // template string for the inner items. Use {anyfield} and {url}, i.e. {headline|title}, if field is of type image it will return url to image (first image if multiple) 'item_current_tpl' => '<a href="{url}">{title}</a>', // template string for the active inner items. 'xtemplates' => '', // specify one or more templates separated with a pipe | to use the xitem_tpl and xitem_current_tpl markup 'xitem_tpl' => '', // same as 'item_tpl' but for xtemplates pages, can be used to define placholders 'xitem_current_tpl' => '', // same as 'item_current_tpl' but for xtemplates pages 'date_format' => 'Y/m/d', // default date formatting for Datetime fields and native created/modified 'code_formatting' => true, // enable or disable code indentations and newslines in markup output 'debug' => false, // show some inline information about rendertime and selectors used as html comments ); $topMenuMarkup = $topMenu->render($options, null, $rootPage); It's long and detailed i always like to see how all options of the Menu are set....so options could be less. Hope this works for others as example how to get there with MarkupSimpleNavigation...on such topics. I like this module very much since in my former CMS there was a great function for generating menus, too. With this kind of generating markup for navigation it is not always easy but it is always very powerfull and if you've it running it a solid solution Best regards mr-fan
-
like i wrote i've added a kind of megamenu (even with images and last articles) with hooks...i'm not at home now but i will prepare a example on this...
-
the mentioned office application is nothing else than a custom frontend - PW original backend is only used for storing the data....so no limts on this side. for the PW backend there are much options on this so you could go: 1. using Lister Pro for creating dashboard like pages in the admin for special selectors you preselect or let the user select... 2. using AdminCustomPages module to simply have the option to work with a "normal" page template in the backend and don't have to code a Process module 3. other options that work but i don't know now....since i've learned that in PW there is always a another way... take a look at existing modules if you wanna learn something about the backend - you could take a look at: - Soma's imagemanager - Code examples from LostKobraKai about using datatable module on own admin pages - renobird's example of a simple process module for admin pages search the forum regards mr-fan
-
How to debug $page->prev - $page->next no output given
mr-fan replied to mr-fan's topic in API & Templates
Thanks for your contribution on this topic. but $anzeige (ad) should only be saved on this pages and on all for example "blogpages" that have the function renderAdsystem() the $page->prev and $page->next is empty..... $page->siblings works the most $page->something that i've tested works...but next/prev don't... so this seems to be a bug or a feature and you need the workaround/option from soma that works so far... regards mr-fan -
oh lucky to purchased one copy of the app - a lot to learn...it's sad that it disapears completly. If Luis don't use or sell it - he could upload it on github to provide it as OS? May i try to write him...we will see.
-
This week like every week i've to write somewhere how great PW is... ...since i am setting up my first bigger website...i choose this threat for my lovestory... I'm just finished with a special eventcalendar....and could manage easy provide .ics files for download and saving events in outlook and many other calendars...just easy. I generate the file at runtime and deliver it. This is the admin.php magic for the right urls: /** * change page name on event pages and add the fileextention to the pagename * chreate pagename-date-id.ics as url */ $pages->addHookAfter('saveReady', null, 'addEvent'); function addEvent(HookEvent $event) { $page = $event->arguments[0]; if($page->template != 'event' ) return; //for this template only //add file extention $fileext = ".ics"; $newName = wire('sanitizer')->pageName($page->title, true); $date = date("Y-m-d", $page->getUnformatted("event_start_date")); $page->name = $newName .'-'. $date .'-'. $page->id . $fileext; $page->message($page->name); } and then just put this in the frontendtemplate: <?php //set correct content-type-header header('Content-type: text/calendar; charset=utf-8'); header('Content-Disposition: inline; filename=calendar.ics'); //get the data for the ical file and create output... and for shure i've this line in my vevent filled with PW as iCalendar Generator: $ical_data .= 'PRODID:-//'.$homepage->title.'//ProcessWire//DE' works like a charm - saving the events in MS Outlook, mobile or google cal. so next challenge on this project is on the plan. Best regards - very busy mr-fan
-
Just an idea...but maybe you can adapt this module to your needs and grad the select data from a different db: https://processwire.com/talk/topic/9320-fieldtype-select-external-option/ or you use on site B a kind of webservice page that output json with id|title|url and use this in site A? http://modules.processwire.com/modules/service-pages/ just some notes on this issue... regard mr-fan
- 4 replies
-
- 1
-
- pagelistselect
- json
-
(and 1 more)
Tagged with:
-
or if you need to point out some rules where such blocks or widgets are should be visible...you could setup a kind of widget system. https://processwire.com/talk/topic/8635-simple-example-for-widget-management/ solution depends on your needs, the project and your preference. regards mr-fan
-
So take a look at the generated template labels and field labels...to get everthing translated. I've you have some special things that are not work please give the exact explanation where the phrase is located may put a screenshot in the post....for me i've all translated in german lang...so feel free to ask. But i need the exact place where i've to look...since i'll glad to help you but at the other side i am lazy, too
-
Events Fieldtype & Inputfield (How to make a table Fieldtype/Inputfield)
mr-fan replied to ryan's topic in Modules/Plugins
Is not needed to delete the posts...you get two valid answers - and your question was valid, too. So everbody can read this without a risk -
you have no issue here - you've just say the module what pages to show....so if you have a spitted menu with topmenu _______ | content | sidebarmenu | you could switch to show childpages to siblings so the submenu is there if you select a subpage of a mainmenu item. //sideBarMenuNav change items to view if($page->hasChildren) { //we are on a first level parent page so show sencond level $entries = $page->children; } else { //we are on second level so show siblings to actual page $entries = $page->siblings; }; using the menu i always show all options to easy change settings and/or see at first glance what is set... //just a example from one of my websites...see max_levels, show_root and other options here //markup is fitting for a bootstrap pill subnavigation... $sideBarMenu = $modules->get("MarkupSimpleNavigation"); // load the module $options = array( 'parent_class' => 'parent', // overwrite class name for current parent levels 'current_class' => 'active', // overwrite current class 'has_children_class' => 'has_children', // overwrite class name for entries with children 'levels' => true, // wether to output "level-1, level-2, ..." as css class in links 'levels_prefix' => 'level-', // prefix string that will be used for level class 'max_levels' => 2, // set the max level rendered 'firstlast' => false, // puts last,first class to link items 'collapsed' => false, // if you want to auto-collapse the tree you set this to true 'show_root' => false, // set this to true if you want to rootPage to get prepended to the menu 'selector' => 'template!=settings', // define custom PW selector, you may sanitize values from user input 'selector_field' => 'nav_selector', // string (default 'nav_selector') define custom PW selector by using a property or field on a page. Use this setting if you want to overwrite the default nav_selector 'outer_tpl' => '<ul class="nav nav-pills nav-stacked">||</ul>', // template string for the outer most wrapper. || will contain entries 'inner_tpl' => '<ul>||</ul>', // template string for inner wrappers. || will contain entries //'list_tpl' => '', // template string for the items. || will contain entries, %s will replaced with class="..." string 'list_field_class' => '', // string (default '') add custom classes to each list_tpl using tags like {field} i.e. {template} p_{id} 'item_tpl' => '<a href="{url}#start">{title}</a>', // template string for the inner items. Use {anyfield} and {url}, i.e. {headline|title}, if field is of type image it will return url to image (first image if multiple) 'item_current_tpl' => '<a href="{url}#start">{title}</a>', // template string for the active inner items. 'xtemplates' => '', // specify one or more templates separated with a pipe | to use the xitem_tpl and xitem_current_tpl markup 'xitem_tpl' => '', // same as 'item_tpl' but for xtemplates pages, can be used to define placholders 'xitem_current_tpl' => '', // same as 'item_current_tpl' but for xtemplates pages 'date_format' => 'Y/m/d', // default date formatting for Datetime fields and native created/modified 'code_formatting' => true, // enable or disable code indentations and newslines in markup output 'debug' => false, // show some inline information about rendertime and selectors used as html comments ); $sideBarNav = $sideBarMenu->render($options, null, $entries); regards mr-fan study all the options kindly (RTFM ) before getting into an issue - this module with all the options is very very powerfull!
-
soma's approach is one file/image == one page - this works great on central based assets like downloads (you could counting the downloads...) For images i used this approach in my first PW projects, too.....BUT i switched to the PW way of handling images. I've used some tools like: ChangeImageSelect - changes the $page of the image select dialog in PW Image Plugin for RTE's https://gist.github.com/mr-fan/4751ea179334139d1f76 AutoImagePages - to have a nice way to upload a buch of images and regardless get single images/pages from the uploaded files https://github.com/mr-fan/AutoImagePages but all this feels a little bit hackish and on the long run the users have to take different places while editing (1. upload images there 2. choose images here)...the Processwire appproach of taking files/images with the needed page (and for shure you have access to images from other pages if needed) is very straight and much easier for the enduser. (1. upload image 2. choose image - all in one place - the actual page) I was stamped by my former CMS to have a kind of media managment....but this is not really necessary on normal pages. And any kind of Overview (Files, Images) and Buchediting could be done with some modules like Lister Pro or BatchCildEditor. My current setup of using files/images: Setting for Content Images - images belong to the used page - images in the content right/left/something else - i use PageTableExtended to render different Typs of Contentblock like part_text, part_image_text_right....and so on (i don't images within RTE fields....so i strict provide my users given "minitemplates" to use - PageTableExtended rocks for such kind of contentblocks) - using CroppableImage or ImageExtra if needed - "cross assets" are under a special imagefield of the homepage (if there was less) and under a special gallery setup in the pagetree (if there was more)... - for special image things like sliders i use an extra PageTableExentended field that renders output in the backend and edit slides via PageTable Setting for Files - using a central hidden place in the pagetree - using one file == one page approach - counting download/access - with this i can provide clean urls like www.mywebsite.com/downloads/file.pdf - using PageTable field to build a User UI for adding new files easy (see screenshot in this topic) best regards mr-fan
-
MarkupSEO - The all-in-one SEO solution for ProcessWire.
mr-fan replied to Nico Knoll's topic in Modules/Plugins
Alternative to changing the module itself is to render the stuff yourself...so you've full control over the output meta tags like Nico wrotes: $page->seo // includes all the default values mixed with the page related seo data // e.g.: $page->seo->title $page->seo->keywords // for rendering all fields with the module $page->seo->render //example with DC and own markup echo '<meta name="DC.descritption">'.$page->seo->description.'/>'; so the tags are up to you in your frontend template. May the best solution if you don't wanna change and maintain module files. regards mr-fan