Jump to content

mr-fan

Members
  • Posts

    848
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by mr-fan

  1. I have a hook after saveReady that change some SEO fields on publishing the page.... my editors should publish a page when the work is nearly finished so content and other things are on the line and i can with some functions create my semiautomatic SEO fields content. Most editors don't care about SEO fields and SEO tab i have to create the content...in the example i use the summary (or in german "kurztext") that exists in article pages, if that summary is not there (like on normal pages) i cut some text from the first textfields of my pagetable contentblock templates...so you can skip this part if you just set the summary to seo_description! So Users could overwright the seo fields but could not leave them empty... Extracted example for seo title and description ignore some own functions for formatting proposal...: /** * Hook for changing seo_* fields if empty on Page Publish */ $pages->addHookAfter('saveReady', null, 'changeSeoFields'); function changeSeoFields(HookEvent $event) { $page = $event->arguments[0]; //for this template only if($page->template == 'artikel'|| $page->template == 'seite') { // page is about to be published if($page->isChanged('status') && !$page->is(Page::statusUnpublished)) { // check if seo_title fields are exist and if they are empty if (!$page->seo_title) { //get the default value that would used as fallback if ($page->headline) { //Headline field is used for seo_title $default_title = ripTags($page->headline); } else { //Headline field empty - page title is used $default_title = ripTags($page->title); } //set seo_title on publishing $page->set ('seo_title', $default_title); } // check if seo_description fields are exist and if they are empty if (!$page->seo_description) { //get the default value that would used as fallback if ($page->kurztext) { $default_desc = ripTags($page->kurztext); } else { //is there a main content block as pagetable field pt_inhalt? if(count($page->pt_inhalt)>0) { //get the first text field in the pagetable and use it for the seo description $first_item = $page->pt_inhalt->get("template=part_text|part_text_image_left|part_text_image_right|part_text_spalten"); $first_content = ripTags($first_item->text); $default_desc = wordLimiter($first_content, 160); } } //set seo_description on publishing $page->set ('seo_description', $default_desc); } } } } Best Regards mr-fan
  2. URL segements are great you could create a own little routing with the different segements to your scripts (login, logout, register...) But if you go the template way with a Adminbranch for example /app/ and subpages like /app/login/ you could take a look at this module from adrian: https://processwire.com/talk/topic/11499-admin-restrict-branch/ regards mr-fan
  3. Oh no problem with delays - we have no contract it's all sparetime and fun and times are not always funny... My condolence for you and your family. Yes your are right the module development is a little lack of examples but some of the existing modules (from ryan and others) give very good insights on most of the things...For me i'm not a developper but i was able to create 2-3 little modules and/or adapt others... May we could team up on this if you have some further time and motivation later this year. Don't hesitate to write me a PM on this topic - nevertheless i like your concept of pagebased comments and would be proud to help even if i not the real PW dev you may wish/need to team up Best regards and wishes mr-fan
  4. I haven't tested the new matrix field for now. PTE renders the selected templates/blocks for the editor. So the dev could create a simple visual blockeditor with drag and drop the blocks and prerender them like it looks on frontend or in a other way that fits in the backend like teammembers, slideimages and so on. Some things to mention: - Care for the used templates to render in SEO things - access the single parts are possible if you don't handle this (for example you have all PTE elements under a hidden parent the elements are accessable on frontend, too) - The CSS for prerendering is sometimes a little tricky since it could be that it crashes with the admin styles (only some special classes and maybe fontsizes and so on) you could use .renderedLayout Class on such elements in your special CSS file for PTE. I'm running PTE for pretty much every repeating element that is more complex like contentblocks, sliderimages with text and settings, teammembers, grouping documents and so on...all things that elements in summary are under a rage from 10 to maximum 40. If i need more elements like events or something i'll stick to pages. best regards mr-fan
  5. Some more examples for content blocks: https://processwire.com/talk/topic/10394-content-block-builder-in-processwire/#entry98527 arjen beat me....but my linked post is with descriptions best regards mr-fan example from a pagetableextended version for the admin UI and with templates as partials that rendered on the frontend side.
  6. Pseudocode from my Phone... If page->template = widget Perfom a 404 error Have a search with Google on the forum About 404 errors and hiding Pages in Frontend... Regards mr-fan
  7. Error messages - steps - output....something more than it don't work would be helpfull. I always use CKE with custom format and style elements - i use custom css for look and feel and custom js for the setup of the items ... regards mr-fan
  8. straight on: https://processwire.com/talk/topic/9691-social-login/ (but actually not active supported from the dev - see last post there) regards mr-fan
  9. It's my nature i like all that works with any kind of pages....basicly i love pages ... I would be glad to test it!
  10. Pleas use the <> Code Button in your Forumeditor since i get ophthalmic cancer while reading... regarding the user image thing you could take a read there: https://processwire.com/talk/topic/10662-display-user-image-error-on-frontpage/ and there https://processwire.com/talk/topic/9779-userimage-and-resize-doesnt-work-on-frontend-with-api/ regards mr-fan
  11. Imagefield for gravatar image to capture: https://de.gravatar.com/site/implement/images/php/ great project! Thumbs up regards mr-fan
  12. Hola qué talYou could simple run this textformatter on the textarea that replacw html strings like & and < and > and " get replaced with HTML-safe equivalents. You have smilysupport and much more options to go... https://processwire.com/talk/topic/1542-module-bbcode-text-formatter/ Best regards mr-fan
  13. You habe read my first sentence? And looked at the small module¿
  14. Batch upload images on folders....a basic script is there...i used on a installation it works...not fancy but it works. https://github.com/mr-fan/AutoImagePages for me i used the term "album" for your "folder" type of page.... Pro tipp: just wait for 'Media Manager' ...could save us a few brain cells, huge folders and a couple of monkeys at the zoo will be the merrier... ...best regards mr-fan
  15. @gmclelland URL segments are teh way to go like Macruras example shows you have complete control to add routing to the existing event page. best general information about URL segments for me is here: https://processwire.com/docs/tutorials/how-to-use-url-segments/ URL segments are really great - i use them very often, too. regards mr-fan
  16. Hi Kiwi Chris welcome to the forums, it's a kind of good that you didn't find this post, https://processwire.com/talk/topic/59-module-want-form-builder/page-6#entry72394 where a honeypot and a emty question field is implemented, so you had to take your first post now and be a part of the community. A OS project lives from comparing and exchanging so every question and every answer is helpful for you and others... I hope this helps you out and your tiredness is gone away. Have fun with PW - regards mr-fan
  17. Hi tom. bad news are here: (files&images are not supported) https://processwire.com/talk/topic/9841-field-dependency-on-image-field/#entry94527 but the good news are there: (go a little indirection) https://processwire.com/talk/topic/9841-field-dependency-on-image-field/#entry94530 hope this helps regads mr-fan
  18. My setup: ->every event is a page ->events are listed only in a overview page ->i change the name of the event pages ot something like my-great-event-title-2016-02-04-id.ics that the page template itself works as a ics file I've this in my event.php: <?php //set correct content-type-header header('Content-type: text/calendar; charset=utf-8'); header('Content-Disposition: inline; filename='.$page->name.''); //get the data for the ical file $homepage = $pages->get('/'); $event_desc = stripslashes(strip_tags($page->event_text)); // get the startdate $dtstart_date = $page->getUnformatted("event_start_date"); $dtstart_time = $page->event_start_time; $tsstart = strtotime($dtstart_time); // get the enddate $dtend_date = $page->getUnformatted("event_end_date"); $dtend_time = $page->event_end_time; $tsend = strtotime($dtend_time); //set the repetition_type to the recur option value $event_repetition_type = $page->event_recur; //set the output for rrule in ical file $rrule = ''; switch ($event_repetition_type) { case '2': $rrule = 'RRULE:FREQ=WEEKLY;COUNT=5;'; break; case "3": $rrule = 'RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=5;;'; break; case '4': $rrule = 'RRULE:FREQ=WEEKLY;INTERVAL=3;COUNT=5;;'; break; case '5': $rrule = 'RRULE:FREQ=MONTHLY;COUNT=5;;'; break; case '6': $rrule = 'RRULE:FREQ=YEARLY;COUNT=5;'; break; default: $rrule = ''; } //build the .ics data $ical_data = 'BEGIN:VCALENDAR'; $ical_data .= "\r\n"; $ical_data .= 'VERSION:2.0'; $ical_data .= 'PRODID:-//'.$homepage->title.'//NONSGML ProcessWire//DE'; $ical_data .= "\r\n"; $ical_data .= 'CALSCALE:GREGORIAN'; $ical_data .= "\r\n"; $ical_data .= 'METHOD:PUBLISH'; $ical_data .= "\r\n"; $ical_data .= 'BEGIN:VEVENT'; $ical_data .= "\r\n"; $ical_data .= 'SUMMARY:'.$page->title; $ical_data .= "\r\n"; $ical_data .= 'UID:' . md5(uniqid(mt_rand(), true)) . '@'.$config->httpHost; $ical_data .= "\r\n"; $ical_data .= 'CLASS:PUBLIC'; $ical_data .= "\r\n"; $ical_data .= 'STATUS:CONFIRMED'; $ical_data .= "\r\n"; if ($rrule) { $ical_data .= $rrule; $ical_data .= "\r\n"; } $ical_data .= 'DTSTART:'.date('Ymd', $dtstart_date).'T'.date("His", $tsend); $ical_data .= "\r\n"; $ical_data .= 'DTEND:'.date('Ymd', $dtend_date).'T'.date("His", $tsstart); $ical_data .= "\r\n"; $ical_data .= 'DTSTAMP:'.date('Ymd').'T'.date('His'); $ical_data .= "\r\n"; $ical_data .= 'CATEGORIES:Landwirtschaft,Maschinenring'; $ical_data .= "\r\n"; $ical_data .= 'LOCATION:'.$page->location; $ical_data .= "\r\n"; $ical_data .= 'URL:'.$page->httpUrl; $ical_data .= "\r\n"; $ical_data .= 'END:VEVENT'; $ical_data .= "\r\n"; $ical_data .= 'END:VCALENDAR'; //output echo $ical_data; ...not the smartest code - could be refactored and opitmized - but it is working for an "save to outlook" link... additional i've a "save in your google calendar" link that works with the google calendar API: //output Ical Outlook link echo '<a href="'.$e->url.'"><span class="fa fa-windows" aria-hidden="true"></span> Outlook iCal Link</a><br>'; //output Google Cal link echo '<a target="_blank" href="https://www.google.com/calendar/event?action=TEMPLATE&text=' .$e->title. '&dates=' .date('Ymd', $e_start).'T'.date("His", $tsstart).'/'.date('Ymd', $e_end).'T'.date("His", $tsend). '&location=' .$e->event_location->title. '&details=' .$e_text_decode. '&trp=true"><span class="fa fa-google" aria-hidden="true"></span> Google Calendar Link</a>'; maybe not the best but useful examples... best regards mr-fan
  19. https://processwire.com/talk/topic/11141-dashboard-redux/#entry104459 best regards mr-fan
  20. http://php.net/manual/en/function.strtoupper.php
  21. In a former CMS there was a very practical "private" state - this means that this kind of pages/content could only be accessable if a user was logged in - but they where in the menu/lists - and you can combine both states hidden + private...
  22. What works even great is a simple SQL dump and the use of the CSV Import module: https://processwire.com/talk/topic/383-module-import-pages-from-csv-file/
  23. I can confirm the same setup is very easy to count clicks + views...i need that for a project. Working good so far. Only difference is that i simple count clicks and views in a integer field without additional information - so it is "data economical" and i've no problem with saved IP's and so on... For manging the banner i use a PageTableExtended Field: I've a general settings about the amounth of ad slots on that page - and a flag option on every single page where a user can set ads to off for a single page. /** * Adsystem show Ads in several templates * * @var $limit (Int) set the limit of displayed ads ->look at anzeige_anzahl /settings/werbeanzeigen/ * @var $headline (string)set the headline of the ad list */ function renderAdsystem($headline = 'Anzeigenpartner') { //get all ad pages on basic setting - unpublished pages are not listed.... $limit = wire('pages')->get('1056')->anzeige_anzahl; //build add output $anzeigen = wire('pages')->find("template=part_ad, limit={$limit}, sort=random"); //render ads and collect them in $all_ads $all_ads = '<h4 class="subtitle">'.$headline.'<h4>'; foreach ($anzeigen as $anzeige) { $anzeige->of(false); $anzeige->anzeige_views += 1; $anzeige->save(array("quiet" => true, "uncacheAll" => false)); $anzeige->of(true); //get the right imagesize $anzeige_bild = $anzeige->anzeige_bild->size(260,120); //build ad link $all_ads .= '<a href="'.$anzeige->url.'" alt="'.$anzeige->title.'"><img class="anzeigen" src="'.$anzeige_bild->url.'" alt="'.$anzeige->title.'"></a>'; } //check if adds are off if ($limit == 0) { $out = ''; } else { $out = $all_ads; } return $out; } All is a page - so the adlink is a page for shure - and for pages we can count clicks == pageviews + redirect and views for every rendering that pageitem somewhere. Just as an addition to the great example from BitPoet! Thanks for that - so i'm tranquilised to find a way that a professional find, too - so it couldn't be that wrong Best regards mr-fan
  24. Ok i tried some different setting, but without luck for the function - but i studied the ProcessPageSearch and found: // non superuser doesn't get any admin pages in their results $s .= ", has_parent!=$adminRootPage"; And now come one of PW greatest things - without fear i switched the parent (for the contentblock root) from my settings page to admin page...with kinda a 300 pages there....switched parent -> all works, editors don't get any single PageTable Pages -> all good! Best regards mr-fan
×
×
  • Create New...