Jump to content

mr-fan

Members
  • Posts

    848
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by mr-fan

  1. 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

    • Like 2
  2. 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

    • Like 4
  3. 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

  4. 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

    • Like 7
  5. 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:

    post-2327-0-54350500-1454176877_thumb.jp

    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

    • Like 6
  6. 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

    • Like 2
  7. Great - thank you very much!

    The query and if statements are never a real problem since i like to try out how it works and dig into - but sometimes i don't find the right hook or methode that i have to jump on (ProcessPageSearch::executeFor).

    Thank you for the hint - i will provide a complete snippet if it works.

    (Just some little offtopic - i place this kind of hooks until now in my admin.php - i don't get the whole difference between ready.php and admin.php...it's not really documentated where i should run/setup different little hooks/tasks better)

    • Like 1
×
×
  • Create New...