Jump to content

mr-fan

Members
  • Posts

    848
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by mr-fan

  1. mr-fan

    Hanna Code

    Does width() or size() not work with Hanna Code? I've something like this: <?php $out = ''; if ( isset($ma) ){ //get mitarbeiter $mitarbeiter = $pages->get("template=part_ma,shortcut=$ma"); if ($mitarbeiter) { //get the original image $image = $mitarbeiter->mitarbeiter_bild; //get thumbnail $thumb = $image->width(90); //render mitarbeiter $out .= ' <div class="b-author"> <p>'.$mitarbeiter->title.'<br><span>'.$mitarbeiter->headline.'</span></p> <img alt="'.$mitarbeiter->title.'" src="'.$thumb->url.'"> </div> '; } } else { $out = 'noting there!'; } echo $out; works in a template but with Hanna code i get Call to a member function width() on a non-object don't know why - if i remove width() or size() image is working but this is not good since it is the wrong size... Best Regards mr-fan (normal single image field without something special - PW dev 2.6.19)
  2. This could done via a "album" type of image field that used for uploading a bunch of images and this images are saved under this parent page as single image pages... https://github.com/mr-fan/AutoImagePages (based on a gist from Adrian https://processwire.com/talk/topic/8698-creating-page-for-every-image-uploaded/#entry84012 ) some more reading starts here: https://processwire.com/talk/topic/8698-creating-page-for-every-image-uploaded/page-2#entry84465 honour goes to Adrian while he has put the main things together and helped me to polish it a bit. Best regards mr-fan
  3. this piece from adobe...is some sort of mini photoshop on every webapp working (even simple websites) https://www.aviary.com/ https://developers.aviary.com/docs/web it is used within this imagemanager plugin for CKE/Tiny/HTML and looks great for such fast/little image edits. http://www.responsivefilemanager.com/ (It's on the third slide i think) and this module i've tested sometimes ago and works even great, too https://processwire.com/talk/topic/1703-pixlreditor/ This are all only solutions where the user/editor has the role to use them - your snippet provide the force to preset effects by the admin/developer...so everything has it's own benefits. regards mr-fan
  4. Thank you Kongondo & @Valan for this great little helper! For me as a non real dev...it is much more easy to get some special admin magic working with this! This is one of the real big things i like with PW - there are tools that helps and can used by non experienced PHP users without to force them to do risky things within the backend...in other systems the level of complexity always grows and grows...with PW it seems it always get easier I'm on a hard deadline this days so less time to contribute but this little snippet may helps others - easy to use and very helpful. It works as a kind of shortcut navigation to prev next siblings - like Kongondo showed off in his video to the notorious V.P.S. I saw the raw links and thought hey i've a version of this running with UI buttons so here we go: $out =''; $siblings = $page->siblings; //generate next & prev links output if (count($siblings)) { $prev = $siblings->getPrev($page); if ($prev) { $out .= '<a href="'.$prev->editUrl.'">'; $out .= '<button type="button" name="button" class="ui-button ui-widget ui-corner-all ui-state-default">'; $out .= '<span class="ui-button-text"><i class="fa fa-angle-double-left"></i> '.$prev->title.'</span></button>'; $out .= '</a>'; } $next = $siblings->getNext($page); if ($next) { $out .= '<a href="'.$next->editUrl.'">'; $out .= '<button type="button" name="button" class="ui-button ui-widget ui-corner-all ui-state-default">'; $out .= '<span class="ui-button-text">'.$next->title.' <i class="fa fa-angle-double-right"></i></span></button>'; $out .= '</a>'; } if ($out <> "") $out = "<div class='NextPrevLinks'>".$out."</div>"; return "<div class='NextPrevLinks'>".$out."</div>"; } Output of the field is: Have fun and best regards mr-fan
  5. Thanks for reading... Your thoughts are exactly what i need..since I bet that I forgot some details like to setup flushing if glossary entries change. And I will take a look into markupcache. Until now I only worked with template cache. Best regards mr-fan
  6. The whole system itself works great i've in the pagetree -glossar (rootpage with BatchChildEditor in Lister Edit mode) --item 1 --item 2 item could be actual an <abbr> or an internal link (with a page field with choosen select) or a external link...but could be everything i will setup on this replacements itemtype is simple choosen by a optionsfield only condition is the title of the glossaritem have to match the term. this could be much more develeopped to get real footnotes or additonal contentypes to replace....
  7. to be honest i'm on a tight dealine for a project i'll use this textformatter first and like i wrote i'm not the great PHP dev. ... so may someone could write if the code seems to be ok or will this give me a mess or performance problem in the long run and important for me while this is nowhere in the doc's are textformatter's output/replacements cached?
  8. Just visit and you'll see who uses WP PW http://processwire.com/about/sites/ to get it down to an final result - take it or leave it - depending on your choice...we all have to choose right or left. What i've figured out is that PW people defend the system if there were serious arguments....and don't get too religious and frenetic if arguments are not on the table. Maybe you'll interest in the great fishy post from ryan
  9. Hi guys, i've just a simple question of a little textformatter that i use for replacing different textvalues. I'm not that experienced PHP professional so i asking before i get in possible troubles... Setup is a "Glossar" like page holder with glossar_entries of various types like (abbr, internal link, external link) In my textfields i use pipes to set a term of that glossary like ||PW|| is great! i can preset ||Internal|| and ||External|| links and reuse them in every textblock...if i change the glossar entry on every page i use this it will automagic change... so far so simple (i've tested autolink and bought Profields...but i wanna give the user the power to edit this entries and have more control where these kind of autolinks work and could used) Here is my first more advanced textformatter on this and my simple question is - will this produce any overload or trouble if i get around about 0-10 terms on a content page? Second Question is on caching with textformatter replacements? How this is handled? <?php /** * ProcessWire TextformatterGlossary * * module made by mr-fan. * 15.09.15 basic class and wrapper configuration added * */ class TextformatterGlossary extends Textformatter { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Autolink from Glossar', 'version' => 101, 'author' => 'mr-fan', 'summary' => "Allows to use tags in textareas to autolink to specific glossary links." //'href' => 'http://processwire.com/talk/topic/1182-module-image-tags/?p=57160', ); } /** * Format the given text string. * * @param Page $page * @param Field $field * @param string $value */ public function formatValue(Page $page, Field $field, &$value){ // use fast strpos check to make sure that $value contains pipes || if (stripos($value, '||') === false) return; //get all terms in ||pipes|| in an array $matches = array(); preg_match_all('/\Q||\E[^|]+\Q||\E/', $value, $matches); //the multidimensional array holds the single strings in the second array['0'] foreach ($matches['0'] as $key => $match) { //get all glossary pages in a pagearray $entry = wire('pages')->find("template=glossar_item,title=$match")->first(); if ($entry) { //entry is found in our glossar pages //rip the pipes $term = str_replace('|', '', $match); //set the replacement depending from the item type switch ($entry->glossar_type) { case '1': //abbr $replacement = '<abbr title="' . $entry->headline . '">' . $term . '</abbr>'; break; case '2': //external link $replacement = '<a rel="help" target="blank" href="' . $entry->extern_link->url . '" data-original-title="' . $entry->headline . '"><span class="fa-globe" aria-hidden="true"></span> ' . $term . '</a>'; break; case '3': //internal link //internal link need to get the url $internLink = wire('pages')->get("$entry->page_link"); $replacement = '<a rel="help" href="' . $internLink->url . '" data-original-title="' . $entry->headline . '">' . $term . '</a>'; break; default: $replacement = $term; } //works the part inside the tags are changed ||test|| on every match $value = str_replace($match, $replacement, $value); } else { //the entry for ||term|| is not found and get renderd without pipes just as normal text //rip the pipes $term = str_replace('|', '', $match); //replace the matches of ||term|| with the cleaned value $value = str_replace($match, $term, $value); } } } } Best regards mr-fan
  10. Ok here you get a example menu from PURE CSS: in my template depending on what setup you've choosen (main.php or head.php) <?php echo $mainMenuNav; ?> and i've a _func.php with my navigation and some other stuff //mainMenuNav $mainMenu = $modules->get("MarkupSimpleNavigation"); // load the module $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' => 'level-', // prefix string that will be used for level class 'max_levels' => 1, // 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' => true, // set this to true if you want to rootPage to get prepended to the menu 'selector' => '', // 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' => '<nav><ul class="nav-list">||</ul></nav>', // 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' => '<li><a class="pure-button" href="{url}">{title}</a></li>', // 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' => '<li class="selected"><a class="pure-button" href="{url}">{title}</a></li>', // 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' => '<a href="{url}">{title}</a>', // same as 'item_tpl' but for xtemplates pages, can be used to define placholders 'xitem_current_tpl' => '<span>{title}</span>', // 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' => false, // enable or disable code indentations and newslines in markup output 'debug' => false, // show some inline information about rendertime and selectors used as html comments ); $mainMenuNav = $mainMenu->render($options); this is the whole simple call to fit PURE CSS classes and all that stuff...is running on this simple website. best regards PW don't have an effect on your frontend - if you get two menues you create or output theme somewhere....
  11. tipp of the day on MarkupSimpleNavigation... take the whole $options in your call....so you can't loose a wrong setting and have a better control of the html output, css classes and so on... from my experience PURE CSS works great with the module..
  12. Great thank you for this closer look on this issue! I don't get it and used the inline workaround on this... Best regards mr-fan
  13. crosslink to other threat that seems to get more in details. https://processwire.com/talk/topic/11035-weird-ckeditor-bug-when-neighbouring-field-is-taller/#entry103393
  14. I can confirm this since 2.6.13 up to 2.6.18 https://processwire.com/talk/topic/10713-field-dependency-switches-uninvolved-ckeditor-field-into-rtl-mode/ You've tracked down the real issue on this - in the other topic we don't get why this happens... i'm working often with two column layout for the fields...and don't get the problem like you. Can you check if inline mode works? This was the result as a workaround since nobody else answers and seems to have that problem. regards mr-fan
  15. let me add some more information you could provide as there was... PW version, screenshots of your template settings. but christophe has wrote the right and important hint already... What profile you used as start for the tutorial? If you get header and footer rendered you should check the settings for prepending and apending templates or includes....so check if you have a _init.php or something else in your profile. For a beginner it could be very strange to get started in face of the many many many options you can take. If you are getting more familiar with the system and find your own way to use templates and site profiles you will love the given freedom. Like in many other topics wrote a: Site profile is only the place to play for your own frontend. Template "files" in the profile are only showing content or data in the way you build it (html,css,json,file,everything you want) Templates itself - with or even without a file (for special contenttype or backend only content...) are a kind of building your content and data model for different needs, you have the power to give them the fields you need, you could connect templates(contenttypes) with Pagefields (example template autor is connected with a pagefield to every article this autor wrotes), you could setup the given fields with various field dependencies, using hooks and much more to get what is needed or should be the final result. Pages are every piece of data, object and could represent every type of content you "preset" with given fields and settings on the used template... Best place to read for beginners is a great writeup for beginners on every important topic....the footer/header includes, too it's a big topic from pwired but it helped me very very much at the starting questions....so take a good read on this. What helped me very fast to get started on the template/field/page thing are some couple of videos, too. Best regards mr-fan
  16. A easy methode to generate Menu Markup is this nice module https://processwire.com/talk/topic/1036-markupsimplenavigation/ It has many options and could generate quite every menu html strucure you need. And for simple API code you could take a read on the forums...the best way is to use Google on the PW site since the forum search isn't that good. And with this way to search the forum you can find an incredible source of reading and learning how to go further. (Even if the posts are from 2013 or earlier the basic will work the most times in the actual PW version too...) first hit on the GoogleCustomSearch: https://processwire.com/talk/topic/686-simple-dropdown-menu/ https://processwire.com/talk/topic/8467-zurb-foundation-problem-with-topbar-navigation/ https://processwire.com/talk/topic/5680-bootstrap-3-navigation-with-multiple-leveltier-fix/ https://processwire.com/talk/topic/2819-dropdown-menu/ https://processwire.com/talk/topic/272-multilevel-menu/ Best regards mr-fan
  17. Ok if i've the time i collect my snippets to a "Tipps&Tricks with MarkupSimpleNavigation" topic - to get things connected. For myself - i always read modulethreat completly if i'm using them to get the best start or knowlegde about the used addon...Read the fucking Manual....is not a option it is a obligation if you are new to a cms/module/technique.... But i will follow your advice since it better fits as tutorials than tracking issues or getting help. Best regards and thank you for feedback mr-fan
  18. BatchChildEditor - provide in the dev version a really nice feature to active and replace the content or children tab with a Lister Interface so handling many pages would be possible for every such userpage. regards mr-fan
  19. take a look at image list label to get thumbnails in the pagetree....so this thumbs are shown also in the pagefield select... some hints to change the image select to a central parent where all subpages are images (usefull if you choose images in WYSIWYG) https://processwire.com/talk/topic/7439-processpageeditimageselect-hook-and-change-default-page/ a little project with some details (at the end of the post you see a pagefield select and the custom adminpage with pagetree with only the images with thumbs) https://processwire.com/talk/topic/7836-cant-wait-first-project-with-pw-nearly-finished/ On some little projects i'll stick to central imagemanagment - but on most sites i've adapted the PW way to connect images to pages... But it's all your choice just some hints to may a easy solution. Best regards mr-fan
  20. mr-fan

    ProcessWire Day

    May it's time for a special PioneerWomen Coffe (couldn't resist in google PW Coffee)
  21. PW 2.6.17 - normal setup - same problem. It seems to be a problem with fieldsets but i've to less skills to figure out what is going wrong here. Workaround for me is using inline mode, too here...but this is not optimal since no bug is better than a workaround. regards mr-fan
  22. Have the same Problem with some fields, too. Have a setup with no imagefields just a pageTable on the maincontent and a aside Wysiwyg where all goes "RTL" but the CSS classes for the instace are alle there and set to "LTR"??? It is no real LTR prompt there just the cursor jumps to the first position in the texarea after every entry?? I've found that this is connected with a Inputfieldtype Fieldset (i used two fieldsets for splitting contentarea in two columns). If the Wysiwyg is in a fieldset then the problem appears. Is the field in a other tab or not i a fieldset there is no problem with editing. And like you wrote if i switch to inline mode it works so far.... Don't get a real solution for this strange thing. Just update dev version from 2.6.13 to .17 and have a look if this is helping on this subject... regards mr-fan
  23. I like this idea! In my former CMS there was a developer that works on all his addons with a basic form-addon that works with exact this methode (json for setup, twig .htt template files for the HTML Output) he called that forms "presets". So answering your questions: 1.)idea is great for every frontend development that usecases are a)simple forms easy to create without ravish backend inputs for forms or rely on other modules b)complexer setups for frontend forms of different types that are easy and very fast to develop with the same schema 2.) keep every form data (json/html/..) separate so structure 2 has my vote - It keeps the filetree clean i think 3.) Would always go for that feature since many forms are have attachments today like applications, userimage upload, image uploads for special propose (on a older site i've just a little form for a village where people could send a foto from a damage or request on the inframstructure/lamps and so on) 4.) wiresmtp or swift should be a better choice than normal PHP mailer... One question on my side. How do you wanna handle the HTML templates and the processing of the inputfields? Could i setup a schema or preset for the HTML output of every inputfield (for example to get bootstrap or UI Kit output) or you catch the replacements of processing with some sort of template engine or simple PHP tags...? Best regards mr-fan
  24. Update to connect information to the forum. Since 2.6.13 sorting is possible from Settings > Module > Page Add http://processwire.com/blog/posts/processwire-2.6.13-and-a-preview-of-prodrafts/#pages-add-new-menu-now-sortable regards mr-fan
  25. If it is a Pagearray you could test before output HTML string with $pageArray->has($page); reference: https://processwire.com/talk/topic/2433-check-if-pagearray-already-contains-a-page/ regards mr-fan
×
×
  • Create New...