Jump to content

OllieMackJames

Members
  • Posts

    356
  • Joined

  • Last visited

Everything posted by OllieMackJames

  1. 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});
  2. @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!
  3. OK I tried the following, but that does not work either: if( $page->id == 1 ) { $site = wire('site'); if (isset($site->page2use4homepage) { $xxxx = echo wire('site')->page2use4homepage; $out = "$page = $pages('$xxxx');" } else { $out = ' '; } return $out; } wow coding is not easy!
  4. @louisstephens thanks but that does not work. I must not have explained myself well enough, apologies. if( $page->id == 1 ) { /* this piece of code must only work if the current page is the homepage - CHECKED this works*/ -> if exist content of repeaterfield named page2use4homepage /*if this field is not filled, then forget about the code and just move on with the rest of the page* - this code is not there yet/ $page = $pages(repeaterfield->page2use4homepageID);/*this will tell PW to pull the contents for $page from $pages(xxxx), where xxxx is stored in the repeaterfield called page2use4homepage, so the question is how to get this value within this function? - my instructions say to use: echo wire('site')->page2use4homepage); but I don't know how to place that in the code so it works. That is where I got the server error*/ else just carry on and forget about this piece of code} What I need is the following code to be the result: if( $page->id == 1 ) { $page = $pages(xxxx);} Where xxxx is the id of the page to be used to pull content to be used for the homepage. What this code does is tell PW that if this is the homepage to pull the contents for the page from page with id xxxx. On the homepage I have a repeater field called sites, with one repeaterfield called page2use4homepage, the content for this field = xxxx and can be called upon within a template with the following code: echo $site->page2use4homepage; and within a function with the code: echo wire('site')->page2use4homepage; so the question is how to write code does this: 1 - check if the page is the homepage 2 - check if the repeaterfield page2use4homepage has a value 3 - if that repeaterfield has a value, get it and input that value in the following line in the place of xxxx ==> $page = $pages(xxxx);} Hope this makes sense. Thanks
  5. @louisstephens thanks for that, I tried this: if( $page->id == 1 ) { $page = $pages(1213);} And that works, but I want to take it one step further, on my homepage template I now have a site settings repeater field. One of these site variables is called page2use4homepage My instructions say if I want to access that in a function I need to do this: echo wire('site')->page2use4homepage; I now need to combine them that would mean: if( $page->id == 1 ) { $page = $pages(echo wire('site')->page2use4homepage);} But that gives me a server error. So I must be doing something wrong here. Thanks!
  6. 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); } and then @Robin S showed me that this could do the trick just as well, with less code: if($page->id == 1 && $page->page2use4homepage) { $page = $page->page2use4homepage; } Thanks all. FYI, here is the original question I have a question how to turn the pseudocode below into something that works in PW I have made a new field called page2use4homepage and added it to the homepage template, which shows this: <?php include("./basic-page.php"); Now to this basic page template I want to add code that does the following: if pageid = homepage -> if exist content of field named page2use4homepage $page = $pages(field->page2use4homepageID); else just carry on and forget about this piece of code} How would I write the above in PW code? Thanks
  7. started a new topic about the necessary code to add to template here:
  8. Just ran the copy repeater matrix action. Works great, thanks again!
  9. THANKS! @adrian and @Robin S You coding giants truly rock and are amazing! I wish I could reciprocate but man alive I wouldn't even know where to begin if it comes to coding. Am I ever glad to have found this wonderful processwire engine with it's amazing community of giants that allow us all to move forward. Best wishes to you coding giants out here!
  10. @Robin S wow! @adrian thanks for your answer. I feel privileged to stand on the shoulders of all you coding giants. I am just a user who runs into stuff and here I am within a day this wonderful community makes things happen. What I am doing with my sites would not be possible without you coding giants. So processwire coding giants, hats off to all of you and a big heartfelt thanks. To all processwire coding giants: may your days be blessed with incredible coding insights that make things happen for all of your personal and business endeavors and may this result in joy and whatever results you wish for in your lives! THANKS!!!
  11. Just installed your module, because I wanted to copy the contents of a repeater matrix field from one page to another. It does not seem to work for repeater matrix fields though. Could you add that as an option? Thanks!
  12. @Robin S, very big thanks! I installed the Admin Actions, but see it does not work with the repeater matrix, only repeaters, otherwise that would be a good option. I like your second suggestion and will go and try that. I'll add a home page template with just one visible page select field that then allows me to select the underlying page that will be used for the homepage per your code above, that sounds like it wold jus do what I want to do. Gotta love this amazing thing called Processwire! Combined with an awesome group of people around it helping each other getting things done. So once again, @dragan thanks for your input and @Robin S you for putting me in the direction of a solution I will use!
  13. @dragan, thanks for chiming in. The site is a small site, and the home page template is used on other pages as well. It is a salessite, where I started with one major salespage as the homepage, but now want to add another page as home page, that is why I want to clone the homepage rather than rebuild it with around 30 carefully built repeater matrix fields on it. "PW-like" to me means to be able to do what is needed. It would be great if there was an option to specify which page to be used for the homepage. How simple can that be? I do not like wordpress (to put it mildly) but I have a few sites running on it, just to try out stuff that I then port to processwire. This particular site is a port of some funcionality that we ported from thrive themes, which now allows me to build very good salespages with an great amount of variety, through the use of repeater matrix. But once a page is built it is so much easier to clone it rather than rebuild by hand. Oh, BTW your suggestion did not work, even with all the settings you specified - which are standard on my site anyways, I do not have the option to clone the homepage. Anybody else know how to do this
  14. How can I clone the homepage? I have a small site where I use the repeatermatrix to build the page, lots of work to build each page, but it makes for very nice looking pages. When I grow the site, I need the homepage to become another page, so I want to clone it or move it. I can copy any other page, but just not the home page, so the core clone module is not the way. How can I do this? Thanks!
  15. Dutch authority site on natural ways to deal with back pain, sciatica and bulging discs: Rugpijnweg.nl
  16. Thanks for this module! I seem to have a problem with it though... I accept the cookie on my homepage, but then on other pages it asks for cookie consent again. I tried with and without ajax, still this message keeps coming back. How can I fix this? Thanks
  17. @psy thanks for that! As soon as I have my schema's ready I'll post here as well. Thanks again.
  18. @psy, great module! Could you please add the video code as well? Example can be found here: http://jsonld.com/video/ Thanks again for making this!
  19. Diogo, I really like this module, looking forward to using this! Thanks
  20. SOLVED: easiest way is to use the HannaCode example from @ryan as mentioned here: https://processwire.com/modules/process-hanna-code/#jumplinks-hanna-code-example-for-import I am trying to get a Table of content that will display - wikipedia style - all different headers on one page in a table. I need the TOC to automatically run down the page and pick the H2, H3 and H4 headers and put them in the TOC, with the link to those headers right in the TOC. Anybody know how to do this? Thnks!
  21. Nice implementation of snipcart, I'm impressed! I like the look of snipcart.
  22. @Harmen one final thing, one of my sites has a pretty good score for speed as measured on gtmetrix.com... 99% pagespeed score and 96% yslow score, so that is what you can do with processwire, procache and a PureSSD vps from transip processwire is pretty awesome if you ask me!
  23. @Harmen, for years I had my own servers, also located at transip, I ended up scrapping that, on the transip vps I still run my own OS (freebsd in my case) and the performance is as good (or better - transip keeps upgrading stuff) as on my own servers (which only is top of the bill the first year, I changed them after three years for the latest and best - go figure what that costs in depreciation) Costwise I now pay for the vps what I used to pay for the colocation. And lastly, I had to go to the transip datacenter at least once a year mostly to deal with a clusterf*ck of my own doing, but also sometimes to swap out a burned out hotswap disc. That is all gone, I ALWAYS have remote access as if I am physically there and transip deals with all the hardware. I now say I should have done this way earlier.
  24. I am on a vps with transip and my sites all run processwire, all working like a charm. very fast sites - I do use procache as well with the cdn function.
  25. Hi Horst, thanks for a great module. Does it need imagick to be installed? I am getting black screens when I try a crop.
×
×
  • Create New...