Jump to content

opalepatrick

Members
  • Posts

    233
  • Joined

  • Last visited

Everything posted by opalepatrick

  1. As soon as I edited that last entry I realised that when I was messing around earlier trying to sort this, I added start=0, to the $page->find selection. So, of course it was returning to 0 every time! Thanks to you all for putting up with my meanderings
  2. OK, still investigating but the top being different to bottom thing is a non-issue... it was caused by a hidden div with a higher z-index. So now I am back to the fact that regardless, the resultset is always the first page. I have re-installed and I am still getting the same behaviour. So, the links look OK, but when /collection/avanti/page2 comes up, the first page is reloaded. It is as if the variable that is storing the current resultset is not being set and therefore it just reverts to zero.
  3. Good point yellowled. Basically on inspection, it spits out identical code. I have pasted them so that I could see if there were any differences. Just that the bottom one functions as you would expect and the top one does not. I wonder if it something to do with the css framework, cos thinking about it, the elements dont respond in the same way on hover, etc. and that should have nothing to do with the code as such. The bottom one acts like it links on hover for instance I can see the url, but the top does not, even though, as I say, the html is identical.
  4. I am using MarkupPagerNav pretty much as per the examples with this being the code. The strange thing is that the $pagination at the top does not work but the one after the product loop does. Two identical bits of code. Any ideas? $selector = "template=fabric,collection=" . $type; $products = $pages->find("$selector, start=0, limit=12, sort=title"); $pagination = $products->renderPager(array( 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='MarkupPagerNav pagination'>{out}</ul>", 'currentItemClass' => "current", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'><span>{out}</span></a>" )); ?> <div class="row mainrow firstrow lastrow"> <div class="pagination-centered"> <?=$pagination?> </div> <?php foreach($products AS $product) { ?> <div class="small-6 medium-3 large-3 columns" itemscope itemtype="http://schema.org/Product"> <a href="<?= $product->url ?>"><img src="<?= $product->images->first()->url ?>" itemprop="image"></a> <div class="prod_panel panel"> <h5 itemprop="name"><?= $product->title ?></h5> </div> </div> <?php } ?> <div class="clearer"> </div> <div class="pagination-centered"> <?=$pagination?> </div> </div>
  5. Thanks a lot to you all. Processwire community is smashing. I used foreach ($pages->get("/about-us/meet-the-team/")->children("include=hidden") as $member) { in the end. Result!
  6. Thanks a bunch DaveP. However, I am still not getting any content. Weird. I tried print_r($staff) and got nada as well. Is there a better way to try and spit out the array? I have checked the settings for the pages concerned and they seem fine and refer to their parent and children as I would expect. Baffled.
  7. For some reason this is not getting the content from the hidden child pages that I was hoping to see. $staff = $pages->get("/about-us/meet-the-team/, include=hidden")->children; ?> <div class="row firstrow lastrow"> <?php foreach($staff as $member){ echo $member->body; } As you can see, I am trying to publish hidden staff pages as content on a single page. Any clues as to what I am doing wrong?
  8. Thanks once again Joss. That worked a treat. The 'last' worked with and without the brackets, but I stuck them in just in case
  9. I am trying to get an image to go along with my search results. I can create the image as a file but of course the path is incorrect as it refers to the search page itself. Any idea how I can reference the relevant assets file folder? foreach($matches as $m) { $img = $m->images->last->width(200); $out .= " <li> <img src='{$img}' /> <h4><a href='{$m->url}'>{$m->title}</a></h4> <p>{$m->summary}</p> </li> "; } Thanks again
  10. Thank you Gentlemen. Do it enough times ad I may get it
  11. I will get the hang of this eventually. I am trying to get a value(s) from a page field that could have multiple values as it used for a multi select field. foreach($page->pattern_type->title AS $pt){ echo $pt; } This is giving me nothing and no error either. Just the $page->pattern_type->title give me nothing either. Any help appreciated.
  12. Thanks Wanze, that just got my head around page fields. I never really understood them until you did that above
  13. I think I may have another issue filtering page fields when working with my search pages. This works fine as all the fields are text fields $matches = $pages->find("template=fabric, title|body|colour~=$q, limit=50"); This does not, I think because the hue field is a page type $matches = $pages->find("template=fabric, title|body|hue~=$q, limit=50"); How can I deal with that if I am correct. I have several page type fields that I would like to include in my search. Thanks
  14. As is often the way, I think I have just spotted my error, and it is nothing to do with the above! Strike that query and apologies to anyone who wasted their time reading it!
  15. Hey, I am running a php script to batch upload images to existing pages. It works fine. However, I had a problem with a few incorrectly named pages, so I updated them via the admin area. Seems fine. Checked the database and the changes are OK. Problem is that when I run the script now the changes are not picked up. In other words it is falling over at precisely the same place using the old file name. I am just calling them (via browser or via terminal with wire) using $wire->pages->find("parent=/fabrics/"); for instance. It feels like a caching problem in pw? Any help appreciated.
  16. Thanks to you both! The $page->collection->first()->title solution was the one that worked as you were quite right it was a page field. Thanks a lot
  17. $products = $pages->find("parent=/fabrics/"); foreach ($products as $product) { echo $product->code; //Produces the correct alphanumeric value echo $product->collection; //This produces a number. Should be something like 'Avanti' } Hey there, as the title suggests I am only getting a numeric id from the above code. You can assume that all other code and values for this template work fine and that there is a field in this template called collections. So I thought I would get the value of this field. What am I missing? Thanks in advance!
  18. Thanks renobird and diogo. That worked a treat! I spent far too long on that
  19. Hi, I am trying to do this: if ($page->parents->has("by-usage")) { where I know the parent name exists and is called by-usage. Is this correct as I am not getting an error nor an expected result? Thanks for the help.
  20. Thanks Martijn, I removed this array('requireSecurityField' => 'security_field') from $page->comments->renderForm() and it now works. I saw that I needed to have a hidden field for it to work. Strangely the other example is identical and does not have the hidden field either but still works. Anyway, I am happy. Thanks for the comments as it made me step though every little thing once more
  21. Getting a "Your submission was not saved due to one or more errors." error message. I do have this working on another site same server, no problem. I have worked through and compared both and I cant see a difference, so a bit baffled. Thing is I am not getting any useful info, even in the error logs. I also have debug to true. Stepped through everything again just in case. Anyone able to point me in a direction to suss the problem?
  22. Ow! That is a bit embarrassing. How many times did I stare at that and not see it? Thanks a bunch Soma & Adrian. Much appreciated.
  23. Thanks for the feedback. It worked as above and I printed out precisely the correct files. However, when I then tried the delete line. It appeared to do something (no errors) but didnt actually delete anything. I then tried remove and the same thing. I have seen other threads that talks about using remove, but as I say nothing disappeared. Latest code: $all_pages = $pages->find("parent=/products/"); foreach($all_pages as $p){ $p->of(false); $i=0; foreach($p->prod_image as $image){ if($i!=0) $p->prod_image->remove($image); // if($i!=0){ // echo $image . " selected to delete<br />"; // } $i++; } } $p->save("prod_image"); I am still looking, but a bit baffled.
  24. Thanks for the pointer adrian. I took so long because I tried to solve the issues I came across. Unsuccessfully! The adapted code I used: $p = $pages->get("parent=/products/"); $p->of(false); $i=0; foreach($p->prod_image as $image){ //if($i!=0) $p->images->delete($image); if($i!=0){ echo $image . " selected to delete<br />"; } $i++; } It took me a while to realise that it was only getting the first product where the parent was products. So $p was a one page array? There should be at least 300+ items in the array. Am I getting confused. Anyway, going around in circles and in danger of disappearing up.... Not a pretty idea. Any help once again?
  25. I accidentally batch uploaded too many images. So now I have 3 or 4 identical images per product in this case. I wanted to delete all but the first. I have tried umpteen options using the API but am a bit stumped. Could someone put me on the right track? Thanks
×
×
  • Create New...