Jump to content

opalepatrick

Members
  • Posts

    233
  • Joined

  • Last visited

Everything posted by opalepatrick

  1. lol, I copied your code and the page id number was different. Feel like a complete (choose appropriate insulting word) - wrong page id - I never noticed! Now eq() works fine. Thanks a lot LostKobrakai
  2. Quotes is not an object so the error makes sense. However I have double checked and quotes is definitely the correct name of the repeater field. Bit baffled.
  3. Thanks LostKobrakai, I wondered about eq() - at the moment this is giving me an error - Error: Call to a member function eq() on a non-object Any ideas would be great.
  4. How can I get the id of a repeater field from another page? I want to do something like if($pages->get(1034)->quotes->id == $i){ echo "Yes"; } Where quotes is the name of the repeater field
  5. I am looking for some help in getting my head around how to do the following. I have a single page site that works great with some handy code (thanks Soma ;-) ) foreach($page->children("has_parent!=2,id!=2|7|27,status<".Page::statusTrash.",include=hidden") as $p){ //if quotes.quote not rendered before in main foreach loop, print next in order echo $p->render(); } This renders out pages as sections. What I want to do now however is pull a quote from a page that has the quotes and attributions in a repeater field and render them after each main section. And, to make it do my head in more, I want just enough to match the available sections, as well as pull them in the order that they appear in the quote page! I am no doubt making this more difficult, so any help in putting my head right would be appreciated. I am thinking I should put a counter $i before the loop then select each repeater quote by id equals $i ?
  6. OK thanks Soma. After a lot of digging around I worked out that it was a foundation 5 javascript option being mis-applied by default. In case anyone else is having the same problem with topbar in foundation 5, then add data-options="mobile_show_parent_link: false" to the nav element
  7. I have two websites using the exact same code with version 1.3.2. There is one dropdown element. On one site the top level element is duplicated in the dropdown on the other it is not (the preferred setup) $treeMenu = $modules->get("MarkupSimpleNavigation"); // load the module $options = array( 'parent_class' => 'parent', 'current_class' => 'active', 'has_children_class' => 'has-dropdown', 'levels' => false, 'levels_prefix' => 'level-', 'max_levels' => null, 'firstlast' => false, 'collapsed' => false, 'show_root' => true, 'selector' => '', 'outer_tpl' => '<ul class="toppad right">||', 'inner_tpl' => '<ul class="dropdown">||</ul>', 'list_tpl' => '<li%s>||</li>', 'list_field_class' => '', 'item_tpl' => '<a href="{url}">{title}</a>', 'item_current_tpl' => '<a href="{url}">{title}</a>', 'xtemplates' => '', 'xitem_tpl' => '<span>{title}</span>', 'xitem_current_tpl' => '<span>{title}</span>' ); echo $treeMenu->render($options); I must be missing something? Can anyone find the needle or at least point me to the right bit of the haystack? Thanks in advance. I posted the code but suspect it may be something in the admin area.
  8. Everytime... Everytime I forget that one
  9. Thanks kongondo, did read but didn't connect that at all. That worked perfectly applied to the hanna code.
  10. Or, have a look at grunt. I use grunt-ssh for sftp along with grunt-sass and other grunt tools. It uploads on save. Have browser alongside and see results on reload. Pretty instant.
  11. yup, wrong terminology, what I meant is that it may be lost in a diverse thread. And I notice you call it a sub-forum, but to me this looks like a big thread? I don't see why a proper sub-forum with multiple threads would be chaotic. It would work just like any other on-topic forum? Couldn't we just as easily say that having a bunch of different points and questions in a single thread is confusing as well? Might seem like I am carping. I am not honest - just wondering about the efficacy of threads like this. Always get great friendly support here so don't think I am being churlish. Anyway.... hopefully someone can help out re the post concerned
  12. I have a Hanna Code question and I am putting it here as a previous post was moved from its own thread. I can't see having a great big thread about a particular module being helpful to anyone, other than as a general module development conversation, and also can't see it being seen? I could understand if it was a separate forum, but not an 11 page thread. Anyway, I am using hanna code for an item in a body field (for a blog post) However, when I publish excerpts of these posts on a summary, I dont want the hanna code to show. I tried to use a bit of php to refer to the template for the individual post if($page->template == 'works'){ echo "<div class='circle floatleft'><h2><i class='fa fa-line-chart'></i></h2></div>"; } but as I am calling the same pages in the summary page $articles = $pages->get("/blog/, limit=10")->children; and looping, then calling $article->body, I think the template of the summary page is ignored. I think the template that the hanna code snippet applies is still the one for the individual post. So, any ideas how I can code out the hanna code snippet on the summary page? Hope that makes sense. Thanks for taking a look.
  13. I just cleared browser history after having a similar problem. Now working fine. Thanks Teppo. Yeah, I know thread is old
  14. Somehow got things working by adding the hanna code module? Maybe I ought to read things a bit more carefully? Baffled but happy.
  15. I have installed and re-installedTextFormatterHannaCode but cannot see the item under setup. It appears fine as an option in a body field for instance and indicates it is installed correctly. For info, I have just upgraded this install from 2.3 to 2.5 but have not seen any other problems. Any help appreciated.
  16. Thanks Teppo, that was bang on. Thanks Mats, didn't know that one either.
  17. $pages->find('parent=/blog/')->last(); This finds the last child by id order, but how can I get the last or first child if I order them by moving them in the admin list of child pages? Basically I want to choose a post to promote maybe by moving the post to the top or bottom of the list of posts in admin. Thanks PS. I know I could choose the id, but I don't really want to have to change the template every time.
  18. The previous advice you gave about checking plugs was on the money, in the sense that it paid to go back to the beginning and step it through. It was caused by the images. Two things compounding. One, I had for some reason uploaded very large images, something I normally never do, but if I remember, I was checking pim and forgot to go back and optimise afterwards. Also, that was compounded by me not using pim properly and stating the quality. I also have a feeling (may be wrong) that the image was being resized every time as opposed to the cache being used. But can't be sure about that. It may have just been the sheer load on the page. I have reverted to previous practice and optimised the images first. Quick with imagemagick and everything appears to be sorted. So with your help, Joss, and Soma's I have managed to swirl back up and out of the rabbit hole I got myself into. Thanks once again. By the way, I reverted to just using size() as well.
  19. Thanks for all your patience Joss. I am using the scenario you referred to with the cats under one parent and the actual products just listed under a different parent. I tried using the id, and it is a tad faster, although it doesn't resolve the issue. Now I am getting more to thinking it may be something to do with the page weight. So I am going to load up some of the other categories to match the number on the problem one and see what happens. The images are definitely not large, but it may be pointing to another issue re my server. So, I will return! It's true about the handyman though
  20. Hi Joss. Minor breakthrough! As you can imagine I have a lot for different categories using this script. I have been testing using just one category. I had stripped everything back to core and instead of looking for 'side chairs', I got bored and looked for sofas and bingo! instant result. So then I restored everything and checked every category without a problem save for that single category 'side chairs' - Really bizarre. So, now I am looking at the difference between that category and every other. Strange one as all I am doing is matching the category with the category field in products. Same as for all the others.
  21. Well, been investigating around in a few more circles I can't execute Soma's code as the page isn't even loading now. It hangs completely using 100% of cpu. (Actually, I went to make a nice cup of horlicks and it had loaded after 5 minutes or so) The max results on this page would be 10 or so products max. So not even scratching it. I replaced wire btw, not that it did any good . Removed unwanted modules as well.
  22. So, just following on from above. I have used that exact same script previously without a problem. It appears to be specific to this setup. Basically when I run it, the cpu shoots up to 100% and stays there and stops every other site on my vps from doing anything. It was working and I cannot for the life of me think what has happened that could have messed things up. I did run a few queries on the database directly without an issue, and on the server using top, the cpu problem is on the apache service (not mysqld). Anyway... rambling. Bit stuck. Any comments gratefully received.
  23. Thanks Joss. I did strip the pim stuff and other bits, bit by bit, but not the headers. Should do that. That is a multiple page fieldtype Soma (not a repeater afaik). I did wonder if that was causing an issue. edit: Stripped headers footers and pim and still got the delay. So, has to be the selector? I should have a loop?
  24. Thanks Joss, they are good at about 5k each. Also, most of them are loading from cache
  25. Trying to work out what is causing an approx. 20 second when loading a page of thumbs for a product catalogue. I have debug = true without any issues. Also, I have checked the server error logs and nothing either. I have several processwire installations on this server all operating fine. Some with very similar setups. I have checked the selector with selector test module and it seems OK. Looking on chrome inspect, the problem is right at the start where the delay occurs. Once that passes, everything loads almost instantly. Also, this occurs on chrome & firefox. Oh, and I should say that no other page is affected that I am aware of. So, as I am finding this a bit frustrating, I was wondering if anyone has any tips as how to debug this? Just in case I have put the code for the page below. edit: One other thing the product_cats field is a page fieldtype. <?php require_once("inc/header.inc"); $type = $page->title; $selector = "product_cats.title=" . $type; $products = $pages->find("$selector, limit=12"); //print_r($products); $pagination = $products->renderPager(array( 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='MarkupPagerNav pagination'>{out}</ul>", 'currentItemClass' => "current", 'firstItemClass' => "arrow", 'lastItemClass' => "arrow" )); ?> <div class="row firstrow lastrow"> <div class="pagination-centered"> <?=$pagination?> </div> <?php foreach($products AS $product) { $pageimage = $product->images->first(); ?> <div class="small-6 medium-4 large-4 columns" itemscope itemtype="http://schema.org/Product"> <a href="<?= $product->url ?>"><img src="<?=$pageimage->pimLoad('myPrefix')->canvas(350, 350, array(255,255,255,0))->pimSave()->url ?>" itemprop="image"></a> <div class="prod_panel panel"> <h5 itemprop="name"><?= $product->id ?> <?= $product->title ?></h5> </div> </div> <?php } ?> <div class="clearer"> </div> <div class="pagination-centered"> <?=$pagination?> </div> </div> <?php require_once("inc/footer.inc");
×
×
  • Create New...