Jump to content

Macrura

PW-Moderators
  • Posts

    2,780
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Macrura

  1. in my config.php, i setup an empty array for siteSettings like this: $config->siteSettings = array(); then in my ready.php file i'm array merging some values from a settings table (profields table), in the admin like this: $st = $pages->get('/settings/')->settings_table; $settings = array(); foreach($st as $row) { if(!$row->value) continue; if($row->disable == 1) continue; $settings[$row->setting] = $row->value; } $config->siteSettings = array_merge($config->siteSettings, $settings); i'm curious if anyone sees any possible issues with this; it works now and i can access my siteSettings everywhere doing this;
  2. sorry if this sounds nitpicky, but i've never seen all caps for php tag (<?PHP) (?)
  3. you'd probably need to redo this logic; 1.) maybe consider an array for your body classes which you an unset keys for based on some conditions 2.) you should not be rendering the sidebar at all if there are no widgets, which means that you need to check your widget counts for each area before _main; that's why you probably need to do a pagearray or something; it's too late to check the selector once you are already looping, unless you can at that point you can unset/set the necessary array key for the body class; this can be resolved but the logic needs to be adjusted because as of now you are assuming there is always something in the sidebars; when i did my example, it was on a template that always had a sidebar no matter what, so i was able to safely foreach those addon widgets; but again, in your case you need to collate your widgets for each respective part of the page before you output any markup so that your body classes can be correct
  4. you may need to make a pagearray, it's hard to tell because i can't see where/how you're excluding widgets by selector. my example runs a 'negative' $page->is($selector) over the found items - i would assume you actually want to find all items that don't have the selector set:
  5. i don't have a file for my settings page, and it works because of the code you put into ready.php in terms of the icon, if you are on Reno you set the icon from the module settings to get your settings to the top menu, just move the admin page to the top of the list.
  6. what i've been trying out today is just doing it in javascript, using this: https://github.com/nwcell/ics.js/ because then whatever events are viewable in the dom can all be put into a one-click add to calendar on the fly I'm showing events list in a datatable) what i'll probably do is put each piece of the info into data attributes, like data-title, data-description, data-dtstart, data-dtend as a test i have this working: ('#download-ics').click(function(e) { var cal = ics(); e.preventDefault(); $("#events tbody tr").each(function(){ var title = $(this).find('h3').text(); var desc = $(this).find('h3').text(); var loc = $(this).find("dd.location").text(); var dtstart = $(this).find("dd.dates ul>li").text(); cal.addEvent(title, desc, loc, dtstart, dtstart); }); javascript:cal.download(); }); you could also have a single click id for the button next to any individual event and then not do the each
  7. just curious if anyone uses any part of that library... http://phpjs.org/ there are some nice little functions here and there you can include in your project and then use the familiar php function; http://phpjs.org/functions/ucfirst/ http://phpjs.org/functions/ucwords/ http://phpjs.org/functions/strtotime/
  8. hey thanks, yeah that was hastily written and untested/not debugged- i just changed the $page var to $event... wasn't sure about the $allowedSegs also; i usually do that in terms of when i'm expecting a small set of segments, like archive, tags, category, etc; in this case you have a larger pool of possible segments, but yeah the logic probably needs to be redone here so that you get the name first and then return the 404 later like you said...
  9. @gmclelland - it should be really simple to achieve an add to calendar, especially with processwire. 1.) check for url segment and if it is valid echo your ical, and exit... /* HANDLE SEGMENT AND ROUTING -------------------------------------*/ if($input->urlSegment2) throw new Wire404Exception(); if( strlen($input->urlSegment1) ) { $pageName = substr($input->urlSegment1,-4); $pageName = $sanitizer->pageName($pageName); $event = $pages->get("name=$pageName"); if($event->id) { header('Content-type: text/calendar; charset=utf-8'); header("Content-Disposition: inline; filename={$input->urlSegment1}"); $options = array( // associative array: // send vars to your vevent processor here... ); wireRenderFile('./inc/vevent.php', $options); exit(); } } } here is the alternate way if($input->urlSegment2) throw new Wire404Exception(); if($input->urlSegment1) { // if urlSegment1 render the single camp $pageName = substr($input->urlSegment1,-4); $pageName = $sanitizer->pageName($pageName); $event = $page->child("name=$pageName"); if($event != '') { header('Content-type: text/calendar; charset=utf-8'); header("Content-Disposition: inline; filename={$input->urlSegment1}"); $options = array( // associative array: // send vars to your vevent processor here... ); wireRenderFile('./inc/vevent.php', $options); exit(); } else { // if the event does not exist... throw new Wire404Exception(); } } you can generate the VEVENT using a class, function etc..
  10. @Erik Richter, I believe your best chance of obtaining a fix for this would be to open an issue on Github: https://github.com/conclurer/PageBookmarks/issues
  11. i would first try running the query once for each of the $parts, and then add the results to a final Pagearray()
  12. Macrura

    5 of a kind

    the blog i setup for 2 of the above has a lot of standard blog features like categories, tags, archive, feeds, comments etc; it was no small effort to set that up, but once i had the basic setup i reused the code; i didn't use the blog module, since i predicted that they would actually never use it, and i didn't have time at that phase to integrate a module, i just did it quick with pages and page selects..
  13. Macrura

    5 of a kind

    aw shucks folks, thanks for the writeup and SOTW ... ! now if i could just get that client to write some blog posts (finding that a lot of clients are insisting on blogs and never using them at all)
  14. @Peter AFAIK if they are hidden then they shouldn't show up in searches to not index an internal link, add rel='nofollow' to any links to hidden pages, or add the noindex meta tag; also make sure you don't have a sitemap listing those hidden pages if there is no link to a page somewhere on your site then it shouldn't get indexed, unless i'm missing something
  15. well you have some fairly nested stuff going on in there, it's tough to read/parse; i think what you'd need to do is setup your standard pagination and give it the necessary details... you may need to remove the first 7 items from this page array and do what you want with those, so that the start is with post 7 this is just a generic snippet showing what i usually do on paginated pages... nothing specific to your question /* GET ITEMS -------------------------------------*/ $items = $page->children($selector)->sort('-date'); //$items_per_page = 8; $items_per_page = isset($items_per_page) ? $items_per_page : 8; $start = ($input->pageNum - 1) * $items_per_page; $total = count($items); $items = $items->slice($start, $items_per_page); // make this to give MarkupPagerNav what it needs $a = new PageArray(); // add in some generic placeholder pages foreach($items as $unused) $a->add(new Page()); // tell the PageArray some details it needs for pagination // (something that PW usually does internally, for pages it loads) $a->setTotal($total); $a->setLimit($items_per_page); $a->setStart($start); $totalPages = ceil($total / $items_per_page);
  16. sure, you could have a hook on page save ready, which checks to see if page has an order number and if not it gets the order with the highest number and adds 1, and then sets the field value
  17. Macrura

    5 of a kind

    wow thanks for looking into that, i may need to upgrade the jQuery plugin (https://github.com/galambalazs/smoothscroll-for-websites); it's a cool plugin
  18. Macrura

    5 of a kind

    ok - thanks again for reporting; not sure what the issue is but it is probably related to the wow animate or the smoothscroll; i do see that the scrolling is faster on that page when i put it side bu side with this window....
  19. @Marco - i believe that MarkupRSSEnhanced module does multiple feeds; i do something like this on my template where i need the feed: /* FEED GLOBAL SETTINGS -------------------------------------*/ $rssTitle = isset($rss_title) ? $rss_title : '9th Planet Blog'; $rssDesc = isset($rss_description) ? $rss_description : 'Official blog of the 9th Planet'; $limit = isset($rss_limit) ? $rss_limit : 10; /* RSS -------------------------------------*/ if($input->urlSegment1 == 'rss.xml') { $rss = $modules->get("MarkupRSSEnhanced"); $rss->title = $rssTitle; $rss->description = $rssDesc; $rss->itemDescriptionField = 'summary'; $items = $page->children("limit={$limit}, sort=-date"); $rss->render($items); exit(); } you can also roll your own feed by using like an atom class: /* ATOM -------------------------------------*/ if($input->urlSegment1 == 'atom.xml') { include("./classes/atom1.class.php"); $atom = new atom1( $rssTitle, $page->httpUrl . 'atom.xml', $default_author, $page->httpUrl . 'atom.xml' ); $posts = $page->children("limit={$limit}"); foreach($posts as $post) { $atom->addEntry( $post->title, $post->httpUrl, $post->wordLimiter('body', 400), $post->getUnformatted('date'), $post->id ); } header( 'Content-Type: text/xml' ); print $atom->saveXML(); exit(); } i'm using a slightly modified atom class from PHP Cookbook, so i can't post it here, but it's a very simple class which extends DOMDocument...
  20. Macrura

    5 of a kind

    @teppo - thanks (as always) for checking these out! On a mac, FF,Chrome, the scrolling seems to be ok..i tried it on a kensington roller mouse and an apple touchpad.. OK - thanks for pointing that out , just fixed it (and a few other things as well while i was in there... site was launched back in October, but i don't think it has seen much traffic)... @bernhard - thanks for checking these out - hoping to post some mini case studies about some things that were developed for these, mostly to do with the blog.. @martijn - thanks - couldn't have done these without your modules!, especially AdminCustomFiles! i think almost all of these use the image tagging setup from this past summer
  21. Macrura

    5 of a kind

    some recently launched pw-powered sites... Roger Shapiro Fund for New Music Custom blog & news, projects listing and works w/ dataTables... using Soma's social share for the sharing buttons http://www.rogershapirofund.org/ Daniel Lippel, Guitarist http://danlippel.com/ Flowers by Selina Website for floral designer in Westchester, NY. Features custom blog, homepage featured portfolio and full masonry portfolio. http://www.flowersbyselina.com/ Eric Huebner, Pianist media handled by Soundmanager2. A frontpage ajax-powered widget was implemented to let visitors browse the concert & event calendar, with a browsable month view. http://www.erichuebner.com/ Anderson Chase Gallery Simple one-pager http://andersonchasegallery.com/
  22. maybe you need this? $table->setEncodeEntities(false);
  23. yeah, turned out i needed the same thing, so there is this now: https://processwire.com/talk/topic/11932-prevnexttabs/
  24. i would just use fields for your fields; there are fields for all of these: date: datetime description: textarea priority: options persons - page multi select progress - options/select or radios, or slider, or pages/radios for the frontend, you use dataTables to list your items; the filters are simple and done with javascript; a lot of examples on dataTables website
  25. you could build your selector with some variables/arrays then you could set those in your init and be able to use them in multiple places,... $excludeArr = array( "template!=home", "template!=basic-page" ); $exsel = implode(',', $excludeArr); $pages->find($exclude);
×
×
  • Create New...