Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by hollyvalero

  1. This is my dumb question for the week. 🤪 I like to clean up unneeded server files... and over time I see a few duplicates with a "." in front of the name... with duplicates below that don't have the leading dot - I assume the .dotVersion is a saved version after a more major upgrade. Should I delete the .TextformatterVideoEmbed ? Any reason to keep it?
  2. While I was looking for a workaround to my MarkupSimpleNav borking over multiple items separated by a pipe: 'selector' => 'template!=home|blog|category' I did an update of a production site and found a similar problem with: $features = $pages->find('template=post|articleblog, limit=1, sort=-date'); Which makes me wonder if this is a pagefinder.php selectors problem and not markupsimple nav? Everything in this installation was 100% up to date EXCEPT the (Dev) upgrade and when I updated that, this OR-condition not supported showed up.
  3. Hi, this used to work when using MarkupSimple Navigation - trying to omit certain pages so "Blog" would appear in the top menu, but there wouldn't be a dropdown menu with endless posts... $treeMenu = $modules->get("MarkupSimpleNavigation"); $rootPage = $pages->get("/"); $options = array( 'current_class' => 'current-menu-item', 'has_children_class' => 'parent', 'max_levels' => 2, 'outer_tpl' => '<ul id="main-menu">||</ul>', 'inner_tpl' => '<ul class="sub-menu">||</ul>', 'item_current_tpl' => '<strong>{title}</strong>', 'selector' => 'template!=post|glossary|category' ); echo $treeMenu->render($options, $rootPage); // render menu EDIT: Played around a bit with this, and it does work with one template as the divider | is what is causing the problem, so this works and if you have only one template that needs this, you're set. 'selector' => 'template!=bloghome' Second edit: I think this was triggered by DEV update 3.0.183 - so this should fix itself, but leaving this here in case anyone has a similar problem....
  4. What I am trying to do: On a blog post page, I am adding a small snippet at the bottom that has the 2 most recent blog posts by the current page author, excluding the blog post title that we are actively reading. That part works... // if this page has an author listed, s/he becomes the active $author and this page is the $activepost if ($page->cbpage2->id) { $author = $page->cbpage2; $activepost = $page->title; // Get the posts... $articles = $pages->find("template=post, cbpage2=$author, limit=2, title!=$activepost, sort=-cbdate" ); // and then format the results for each found... foreach ($articles as $article) { echo "..."; } One author post had a comma in the blog post title which broke this, and I assume this needs to be santized because I reference title!=$activepost this didn't work... $articles = $pages->find("template=post, cbpage2=$author, limit=4, title!=$activepost, sort=-cbdate" . $sanitizer->selectorValue($title)); I assume I have to sanitize BEFORE: $pages->find since it's dragging in the comma, but since I have the $activepost = $page->title; No method I've tried seems to be working. Rather than tell everyone "don't use commas!" I'd love to figure this out, but coming up with tragic results like: $dirtyarticles = $pages->find("template=post, cbpage2=$author, limit=4, title!=$activepost, sort=-cbdate") $cleanarticles = $sanitizer->selectorValue($dirtyarticles)); and that sure isn't right... 🤪
  5. @Robin S - thanks! That worked beautifully.
  6. I've been using this approach for just what you mentioned... shortening blurbs and tucking them into a page with several other items of like type... but this works great but launders out numbers... So something like "Average temperature data for each month from 1880 to 1990 to is displayed"... Comes out as "Average temperature data for each month from to to is displayed"... I see a code mention of mixed, for a mixed string, but can't figure out how to incorporate it...
  7. EDITING TO ADD FIX: after comparing the two installations, one had Hannacodehelper still installed - so I deleted that and it's working just fine now. I have a website with a lot of charts in Hanna Code snippets. When trying to edit pages, getting a big fatal error - which is new. When I installed this it was working fine, so something since then seems to have triggered it. Fatal Error: Undefined class constant 'DEFAULT_OPEN_TAG' (line 111 of site/modules/HannaCodeHelper/HannaCodeHelper.module) - everything is up to date - PHP version is 7.3 - compiled files cleared - cache cleared Error log in PW says: Fatal Error: Undefined class constant 'DEFAULT_OPEN_TAG' Line 111 of /site/assets/cache/FileCompiler/site/modules/HannaCodeHelper/HannaCodeHelper.module Referring to: // basic settings $data = $this->modules->getModuleConfigData('TextformatterHannaCode'); $openTag = isset($data['openTag']) ? $data['openTag'] : \ProcessWire\TextformatterHannaCode::DEFAULT_OPEN_TAG; $closeTag = isset($data['closeTag']) ? $data['closeTag'] : \ProcessWire\TextformatterHannaCode::DEFAULT_CLOSE_TAG; Front end is working fine, and overall backend is accessible. Any clues?
  8. In a blog, I have a page field that references a library of writers (cbpage2) so their info doesn't have to be reentered for each post. At the bottom of the post I wanted to list, " the last 2 posts by THIS AUTHOR, but obviously not include the CURRENT PAGE POST" EDITING TO REMOVE ALL BUT THE apparent answer When I used title to match the variable $activepost it seemed to break - title too long? But when I matched it to the ID it seemed to work... $author = $page ->cbpage2->id; $activepost = $page->id; $articles = $pages->find("template=post, limit=50, cbpage2=$author, id!=$activepost, sort=-cbdate");
  9. I noticed this too in 3.0.173 and when I rolled back to 3.0.172 it went away.
  10. Pagination usually works just fine. I had 2 identical production sites - I was updating code in one when I found the pagination for a publication library was not working. MarkupPagerNav was the same in both (image 1) But the Dev version was different. (image 2) 3.0.173 was NOT paginating Pagination was working in the one with the older DEV (image 3) 3.0.172 Until I updated that installtion to 3.0.173 After the update it delivers the correct URL, but a 404 page (image 4) I rolled back the update to DEV 3.0.172 (image 5) and pagination is working fine... So... fixing this is above my pay grade 🤪
  11. I have a text field called tweet. I'd like to display it: $tweet: This is a sample tweet to @hollyvalero using a #hashtag, or #twotags and create a tweet button to convert that tweet as postable... I've removed the whitespace and replaced it with + signs if ($item->tweet) { $tweetable = $sanitizer->removeWhitespace($item->tweet, ['replace' => '+']); echo "<div class='twitterformatted'>{$tweetable}</div>"; } this gives me: This+is+a+sample+tweet+to+@hollyvalero+using+a+#hashtag,+or+#twotags in a link tag, the @handle works fine, but I need to replace the #hashtag with %23hashtag Trying to use a two-step approach with sanitize->chars but I don't see how to turn: $replacement = '' into replace # with '%23' ... $hashtag = $sanitizer->chars($item->tweet, '%23' = '#'); $tweetable = $sanitizer->removeWhitespace($hashtag, ['replace' => '+']); How do I word this?
  12. If it's not a matter of life or death, I sometimes just leave the page hidden instead of unpublished for a short while... hidden is viewable with the link but it shouldn't show up in the nav, etc.
  13. I’m looking for examples of how to use the page reference method. It seems like that’s the way to go. the page reference field is billcalendarbillref and it’s in the events records found. I need to match that field to the page title of legislation pages using the trackerplus template.
  14. I have 2 templates: Legislation and Events Legislation template fields: billnum (eg 1234) billtype (eg SD, LD, LR) title (An Act to Whatever) clients - a page reference field. We start with legislation of interest to a specific user who has tagged clients by role for that search string...and sort them by committee $user_roles_string = $user->roles->find('name!=guest')->implode('|', 'name'); $bills = $pages->find("template=trackerplus, limit=600, client=$user_roles_string, sort=billscmte"); And for each bill, we list clients which is simple since we prequalified them and that field is in this template: foreach ($bill->client as $c) { echo "{$c->title}"; } On the Events template, we have a single page reference field that references the piece of legislation above, with a custom format label that brings in {billtype} {billnum} {title} billcalendarbillref When outputting events, again, I use the user roles string to get the batch. $user_roles_string = $user->roles->find('name!=guest')->implode('|', 'name'); $events = $pages->find("template=trackercalendarevent, client=$user_roles_string, sort=$cbdate2, limit=600, cbdate2>=today"); For each event I want to create a similar loop to list the clients, but I need to look up the legislation to find a match first - using just the prequalified group of events. // if there is a bill reference in the event item if ($event->billcalendarbillref->id) { // locate the legislation page that matches the billcalendarbillref, get the clients listed, and print them out. $items = $pages->find("template=trackerplus, title=$event->billcalendarbillref->title, limit=1"); foreach ($items->client as $c) { echo "{$c->title}"; } } This doesn't seem right...Not sure how to word the match between [template:trackerplus, title] and [template:calendar, billcalendarbillref] ... I thought maybe I should be using $items = $page->references(); but then got hopelessly confused... It's printing blank instead of an error which is a nice change of pace. 😃 What am I doing wrong?
  15. That's exactly what I was looking for and it works beautifully!! Thank you so much! I haven't done much with multiple roles per user... this is terrific!!
  16. The set up: Lots of content shared by a variety of clients. To view data specific to one client, I've set up a role - Acme - and an associated template acme.php, so when the Acme user logins in, I can pop them directly to their Acme page where they only see Acme stuff. This works fine. That page loads various content pre-qualified by the client. I have the logins set to pop them to their page automatically. $bills = $pages->find("template=trackerplus, client=$page, limit=200, sort=title"); The challenge: I have internal users who manage several clients and want to see that same data but instead of visiting 3 pages, they want one page that lists all of the data for each of their clients only. I can add the roles: Acme, MegaCorp, for each internal user. I want to do the same kind of content display, but I need to sort the content If user jsmith is associated with the roles Acme, MegaCorp if user kjones is associated with the roles Brown, United jsmith logs in and sees the client data dump for acme and megacorp only. The field: Each content item has a multiple page reference field called client that I need to match to the roles of the user... and I need a list of names, not ids and trying various ways none of which are working... Assume I need to create a variable, and empty it out... then add the name for each one to the variable... $clientList = ''; foreach ($user->roles as $role) { add $role->name to $clientList; } $bills = $pages->find("template=trackerplus, client=$clientList, limit=400, sort=title"); Any assistance would be most welcome! 😓
  17. Hi! I'm experimenting with Ryan's RCDmap.js... got it all working but just wanted to use SVG images for the map markers. There's no class I can get... and #map .svg doesn't work. It seems like there should be a way in defining the icons to add something similar to iconSize: [30,30] or google's map options: size: new google.maps.Size(71, 71), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(17, 34), scaledSize: new google.maps.Size(25, 25) Not having much luck... and yes, I can do very tiny png images but they are tend to get blurry on higher res devices. Not sure whether I should just try leaflet maps instead. /* The path to the icons folder */ var path = '/site/templates/icons/'; var marker = new google.maps.Marker({ position: latLng, map: RCDMap.map, icon: path + cat + '.svg' });
  18. This is such a great addition to ProcessWire and SO useful, that I think it should be part of the core!!!
  19. * Yes! That's why I figured it wasn't available, but maybe could be...It's not a deal breaker because the pages would be filed under City -> Location (like the dog park) and the breadcrumb nav is most likely to be to back up to the city level... but to "see all dog parks" I'd need to find a way to dynamically link that page URL data source. On the city page I could... pages->find template=location (used by all) $page=city (locations are filed under cities) sort=title or sort by $ds->cat1 To link to a category since each is unique, maybe pages->find $ds->cat1=title but if it was a data source property echo $ds->cat1URL then you could avoid the find->step and it would be an elegant way to create a rich breadcrumb if using DS for page navigation elements. BTW -> I love this module. I had page reference fields originally and thought, good lord... what if there are 600 categories/subs/etc. It would be a nightmare to have to start at the top level each time. So this is really brilliant.
  20. I'm working on a project to grow my programming skills a bit by making a Yelp-style directory that could be used for any dataset of things like parks in the state of Maine. I've created 3 templates so the page tree is the source of the categories for a drilldown like: Outdoor Lifestyle (cat1) -> Parks (cat2) -> Dog Parks (cat3) Added dynamic selects and created a field called categorytree and set up the three so in the backend choosing top level, level 2 and level 3 categories is a dream. and having no problem displaying a basic breadcrumb... so when you get to the data dump for a location you get the breadcrumb: Outdoor life / Parks / Dog Park. $ds = $page->categorytree; echo "<ul class='uk-breadcrumb'> <li>$ds->cat1</li> <li>$ds->cat2</li> <li>$ds->cat3</li> </ul>"; Been going through the comments and I'm not sure this is possible, but wanted to make these live breadcrumbs...since all the data sources are pages... sort of like this, but obviously not this... Not sure in reading the previous entries whether this is possible? <li><a href='$ds->cat1->url '>$ds->cat1</a></li>
  • Create New...