-
Posts
121 -
Joined
-
Last visited
Everything posted by hollyvalero
-
* Oh, yeah... I'm using these for things like moving a photo from the left side of a block to a right side, adding padding of various amounts, etc.
-
Okay, never underestimate the power of anxiety... this seems to work: {$page->fieldName->value}
-
I use the Fieldtype: Select (AKA Drop Down) a lot. And I'd be happy to switch to the Fieldtypeoptions, but I need something that allows me to create a variable, and show a human name to the user ... Something like this: left:=left right:=right The FieldtypeOptions creates this: 1:left 2:right I use them for a variety of things like choosing image effects on photos... uk-background-blend-color-dodge:=Color Dodge uk-background-blend-color-burn:=Color Burn uk-background-blend-hard-light:=Hard Light where I can add to the code: {$item->imagefx} on an image. What is the workaround for this?
-
Edited to say that I found the reference, deleted and it worked... but if it's worth anything, problem showed up with pw master 3.0.227 and dev 3.0.228 -- it may have been old references...
-
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?
-
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.
-
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....
-
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... ?
-
@Robin S - thanks! That worked beautifully.
-
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...
-
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?
-
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");
-
PW 3.0.173 – Core updates, new hook type
hollyvalero replied to ryan's topic in News & Announcements
I noticed this too in 3.0.173 and when I rolled back to 3.0.172 it went away. -
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 ?
-
Sanitizing Hashtags from # to %23 to create a tweetable tweet?
hollyvalero replied to hollyvalero's topic in General Support
That works! Thank you!! -
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?
-
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.
-
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?
-
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! ?