OllieMackJames

Members
  • Content count

    262
  • Joined

  • Last visited

Community Reputation

107 Excellent

About OllieMackJames

  • Rank
    Distinguished Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

4,317 profile views
  1. OllieMackJames

    Nice! Very interested in your padloper/mollie combination looking forward to your open sourcing of the payment module you built.
  2. OllieMackJames

    @wbmnfktr thanks lots, if I could get that to work, that would make me happy! This works beautifully [[jumplinks for=h2]] with your code did it all in one go! I tried the following code, but it would not work, can you see where I went wrong? <?php // $for defines the headlines you want to take care of. // i.e.: h2, h3, h4 $for = str_replace('h2', 'h3', $for); $for = explode(' ', $for); foreach($for as $k => $v) $for[$k] = trim($v); $for = implode('|', $for); $anchors = array(); $value = $hanna->value; if(preg_match_all('{<(' . $for . ')[^>]*>(.+?)</\1>}i', $value, $matches)) { foreach($matches[1] as $key => $tag) { $text = $matches[2][$key]; $anchor = $sanitizer->pageName($text, true); $anchors[$anchor] = $text; $full = $matches[0][$key]; $value = str_replace($full, "<a name='$anchor' href='#'></a>$full", $value); } $hanna->value = $value; } if(count($anchors)) { echo "<ul class='jumplinks'>"; foreach($anchors as $anchor => $text) { echo "<li><a href='$page->url#$anchor'>$text</a></li>"; } echo "</ul>"; } else { echo ''; } @bernhard thanks, I prefer not to go the route of repeaters here, as I just want to write the article and use h2 and h3 headers and then let Hanna deal with it. But thanks for chiming in, much appreciated.
  3. OllieMackJames

    SOLVED - Thanks to @wbmnfktr for pointing out that this was already made possible with Hanna code, big thanks therefore to @ryan who even gave this as a working example of what could be done with Hanna code. Man this forum is awesome, this CMS is awesome, and now my site gets one step closer again to awesome for my visitors as well, thanks all! Leaving the original question below in case someone searches the forum for this exact same thing. ===========================original question below============================ I need a way to automate getting a table of contents on a really long page that I write. The sections on the page that need to end up in the TOC all have h2 headers. So I need the TOC module to loop through the page and take every instance of a h2 header and use that to buld the toc with clickable links to that particular h2 header Anybody have an idea how to do this? SOLVED
  4. OllieMackJames

    @Robin S thanks, much appreciated!
  5. OllieMackJames

    I am trying this out in a json-ld setting and running into some trouble. For json-ld I need the content of the whole article om any give page. On this particular site we build pages with different fields, including matrix repeater fields. 2 problems, I see lots of markup like h2, span etc in the output, and the matrix repeater fields are not taken into consideration at all. What I need is the unformatted output of all the individual fields, including from the repeater matrix to show up in a concatenated field. Thanks!
  6. OllieMackJames

    I like what you did with the homepage, asking people what they want to trade, and then based on their answer you show the next question etc. Can you perhaps explain how you did that? Nice work!
  7. OllieMackJames

    Thanks, that should get me going. Much appreciated!
  8. I have a site that exists since 2003, but has been on different platforms, html, modx and then processwire. And then on processwire we also migrated the site to a whole new design, which meant we started from scratch and imported some stuff. As a result my created and published dates are all over the place and not showing the history of the site. OK what is my question? How can I (re-)set the published and created dates for individual pages. Par example the homepage is created in 2003, but since the redesign of the site in 2015 proceswire now says the homewpage was created and published in 2015, but that is not true of course. Hence I want to set the created and published date back to the start of the site and then show the last modification to the page via datemodified. Anybody know how and where to set the published and created dates? Thanks.
  9. OllieMackJames

    @Robin S and I thought it couldn't get any better and now you improve it again! Just tested it and it works, THANKS.
  10. OllieMackJames

    @zoeck Thanks and how would I get what I want with $mypage code then? I believe when I use $mypage then I would need to change all templates to use $mypage in stead of $page and this way I can keep everything as it is, and just when I need it, I can swap the homepage, while even keeping the actual content on the page with id=1 unchanged. Maybe I want to check conversions to see which page converts better. I built my sites to generate action and my designers tell me that my pages are way too long, but hey I tested short and long and the longer pages until now ALWAYS outperformed the shorter pages. I tested design and found that design does not make much difference at all. It is the text and the flow of the text that makes all the difference. I tested video and found that text pages still outperform my videosalespages, but videos strategically placed elsewhere have doubled my conversions on my salespage. So the code below does just what I need, spot on, what can be wrong about that? /* fill in pageid of page to be used for content homepage*/ if($page->id == 1 && $page->page2use4homepage) { $p = $page->page2use4homepage->id; $page = $pages($p); } When I don't want to use the contents of the homepage, I just take the contents of another page. And whether that is good or not all depends on what one wants to do and to me this is the exquisite beauty of Processwire. It totally allows me to do what I feel is needed at any moment, even if that goes against the grain of what others consider not good. Like I said in my other post, there are definite reasons why I want to do this, it allows for using a homepage on a live site, then changing the underlying page that is used to pull content into the homepage. And the code above works like a charm! And what I also like about processwire is this wonderful forum, where people and help each other, so @zoeck , @kongondo, @louisstephens big thanks for taking out of your time and helping me, much appreciated.
  11. OllieMackJames

    Whether I like it or not, I have to deal with this nonsense. Small sites have been fined in my country already for not having clear refund policies par example. What I do is have a contract with a third party who keeps all legal stuff for websites that are working in the EU up to date to EU laws. They tell me what kind of legal pages, privacy statements etc. etc. to have in place. They are also now working on checking what to do with the new privacy regulation. Once they have that ready, I'll just add or adjust what I currently have on my site. Of course this is not for free, but 80 euros or something around that order, is not too bad for some peace of mind. This is what I work with: https://www.webwinkelkeur.nl/ it is a Dutch site.
  12. OllieMackJames

    OK, thanks all, I finally got it working, this is how I managed to do it: /* fill in pageid of page to be used for content homepage*/ if($page->id == 1 && $page->page2use4homepage) { $p = $page->page2use4homepage->id; $page = $pages($p); } Thanks all.
  13. OllieMackJames

    @kongondo thanks for your thoughts and no offence taken - the opposite I value your and anybodies input and just realize I am not good at explaining what I want to do. For reasons mentioned in I DEFINITELY do want to use this code and am using it as below now, but hardcoded, so each time I want to change it I change the code in the template, but I want to do that without touching the template itself: /* fill in pageid of page to be used for content homepage*/ if( $page->id == 1 ) { $page = $pages(1213);} So that is why I want to specify the pageID, in this case 1213 on the homepage admin side via the field page2use4homepage. And I want the double if statement like mentioned in the first post. Let me try and explain it again: If this page is the homepage AND if the field page2use4homepage is filled THEN $page = $pages(get value from homepage-field-page2use4homepage and insert here) Hope that makes sense. I am aware this might go against what others consider done or not done, but hey, this is what I want to do so if anyone can tell me how to get the content of that field on the homepage into the code, great! So if I can invite anyone to just focus your coding smarts on how to make this happen, that would be great!
  14. OllieMackJames

    I tried this as well and no luck either: if( $page->id == 1 ) { $page2use = $page->page2use4homepage->id; $page = $pages('$page2use'); I also tried: if( $page->id == 1 ) { $page2use = $page->page2use4homepage->id; $page = $pages({$page2use}); and also this without luck: if( $page->id == 1 ) { $page2use = $page->page2use4homepage->id; $page = $pages({echo $page2use});
  15. OllieMackJames

    @zoeck thanks for thinking along. What I have done now is forget about the repeater field and just made a pagereference field called page2use4homepage I can call this with the following code which I checked that works: <?php echo $page->page2use4homepage->id; ?> What I now need is to take $page->page2use4homepage->id and use that, but that does not work either if( $page->id == 1 ) { $page = $pages({$page->page2use4homepage->id}); } thanks!