Search the Community
Showing results for tags 'foreach'.
-
I was previously using individual fields to capture and output multiple cards onto my web page but after recently learning about repeaters would prefer to use this field type, as it will be a lot more user friendly for end users to create new cards. I tried to modify my code to grab the fields from...
- 3 replies
-
- modules
- foreach loop
-
(and 3 more)
Tagged with:
-
From my last post, I was given a good idea on how to count the repeater items, and it worked wonderfully. I got my code working well and the columns (based on the count) all work well as well. Now, I have a head scratcher on my hands. <?php $buttonsIncluded = $page->special_custom_buttons->fin...
-
Hi all I have a problem here. I created a gallery with 240 pictures. Created an images field with no maximum amount (0). Unfortunately, only 98 of the 240 images show on the website. Any idea what I possibly could have done wrong? Thanks for your help! <?php foreach ($page->images...
- 17 replies
-
- images foreach
- images
-
(and 1 more)
Tagged with:
-
Hello ! I have somehting I don't understand here... Here's my code : $allPlayers = $pages->find("parent.name=players, team=$selectedTeam"); $allTrains = $allPlayers->find("template=event, task.name~=ut-action, refPage!='', date>=$startDate, date<=$endDate, sort=refPage, sort=date"); bd('$al...
-
Hi All, maybe a really stupid question, but is there a way to sort repeater items on -created? Like $page->social_activity('limit=10,sort=created'), with 'social_activity' as the repeater field? Tried this but it didnt work ? Any help appreciated!
-
I am currently working on a site that lists about two hundred product series, which are displayed to the visitor as a web page. Beneath each of these Series pages are one or more children, and they may be nearly identical, with a few key differences. Does anyone have any advice on how I might ru...
-
So I have a bit of code for ad management : <?php $ads = $pages->find("parent.template=client, sort=expiration_date"); $alert_count = 0; foreach ($ads as $ad) { $todaysdate = date("F j, Y H:i"); $today = strtotime($todaysdate); $ex...
-
I have a foreach loop on a dashboard page where I sorting the pages titles to different columns based on a date field. Unfortunately, I am doing it with multiple different if statements for the sorting (with multiple foreach loops), as I needed something quickly for testing. I thought it would be ni...
-
Hello all. Yesterday working on my Cooking Recipes profile I stumbled across an interesting issue - how to show pages published/created on a specific time interval without the use of any plugins but just the default API of PW. Thanks to @abdus the sollution was implemented and was working perfectly...
-
Hello everyone, i have written a simple function to render the Navigation for my "Onepager" Here is the code: <?php function renderOnepagenav($onepageroot) { $sections = $onepageroot->children; echo "<ul>"; $id = ''; foreach ($sections as $item) { $id ++; echo "<li><a href='#...
- 9 replies
-
- onepage
- navigation
-
(and 1 more)
Tagged with:
-
I am using the below to go several levels deep, but when using a select of "limit" or "sort" I am getting strange results. For example, if limit=2 I get five results. If limit=3 I get six results. I am sure I have messed up something. Maybe there is a better way? $cats = $pages->get("/mypage/")-...
-
Hello, I have a page that consists of the body of the page and the title and bodies of it's childpages with a foreach. That part works. Each childpage can have a sidebar if filled. What I can't get done is getting the childpages of the childpages. I want the titles of those child/child pag...
-
Hi, I'm using this piece of code to retrieve the names of two arrays of images and it works really well. But my question is how can I use only one foreach so i can use both arrays inside of it? Thanks very much. $precioschico = $page->get("planos"); $preciosgrande = $page->get("mapas"); foreach...
-
I came across a foreach example that I was able to customize a bit without several error messages. Yes, I am new. Be kind... coming from Modx. Basically, 80% of what I need in most web development is: bring back a bunch of fields from THIS parent page or THIS template... and display a limited numbe...
-
Hi everyone, I'm new to processwire and have just started playing around with it for the past week. At the moment, I'm trying to use repeater fields and am having difficulty getting them to output to my page. Instead, what bizarrely seems to be happening is that half of the foreach loop declara...
-
I had a sidebar template set up with a repeater (as it needed to display links offsite) and everything was going smoothly: <ul class="sideNav" data-spy="affix" data-offset-top="490" > <?php foreach($page->selectHeader->pageSidebar as $sideNav) { echo "<li><a href='{$sideNav->side...
-
I want to create a basic breadcrumb menu on my site and i'm using this code <?php $parents = $page->parents(); ?> <?php foreach( $parents as $item): ?> <span><a href='<?php echo $item->url; ?>'><?php echo $item->title; ?></a></span> <?php endforeach; ?> <span><?php echo $page->title; ?></span>...
- 4 replies
-
- breadcrumb
- foreach
-
(and 2 more)
Tagged with:
-
Hi all, I need to loop over several images with an ordinary foreach - nothing fancy. However, each image needs to have a unique css class name attached. Here is a simplified example: <ul> <li><img class='mac' src='#'</li> <li><img class='ipad' src='#'</li> <li><img class='ipod' src='#'</li> <...
-
Hi all, Newbie here, so hopefully I'm not asking too silly a question. Following a tutorial, I've set up a very simple site. I've created a page with three (test) childpages. The template file of the parent page is supposed to display all the child pages' fields using a foreach loop. The code I'...
-
I am finishing up my first processwire site (yay), and this last bit is giving me a bit of a headache: For a news slider, I want to output x number of posts, with three posts per slide. (for a theoretically unlimited number of slides) I figure in theory this should work something like the code belo...
-
hey community! maybe i'm on the wrong way but here is what i'm trying to do: i have a page called "tickets" with a template "tickets_index" which only renders a list of the page's subpages. the subpages (aka "the tickets") uses the template "ticket" which outputs all the fields of a subpage (aka...
-
Hi everyone, thanks in advance for your help. I have an Event set up using a datetime field. I'm trying to grab the earliest event that has not yet passed, e.g. soonest upcoming event. This is what I have so far. <?php $today = mktime(0,0,0,date("m"),date("d"),date("Y")); $events = $pages...
- 16 replies
-
- conditional
- foreach
-
(and 1 more)
Tagged with: