-
Posts
812 -
Joined
-
Last visited
Everything posted by a-ok
-
Hi folks, I have a simple PageField set up, which is being used in this instance as a 'Related Articles' area; they can choose (Multiple Pages) which news articles are related then it does something nice front end. The only issue I have is that I'd like to limit the number of articles they can choose (only allowing three, for example) much like you would have in a File field or Image field (Maximum files allowed). Any thoughts?
-
Is there any way to return <?php $sectors = $input->get->project_sectors; ?> as the titles, and not the names? So instead of, for example, it returning landscape-design (the name) it would return Landscape Design (the title). Thanks, R
-
Any update on this? I'd like to show only pages where the date field hasn't passed yet: <?php $today = strtotime(date('Y-m-d')); $events = $pages->find('parent=/events/, date>$today, sort=date'); ?>
-
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
Anyone else with any idea why commas don't work in the URL? For example, this URL returns no results: http://localhost/Freelance/levitt-bernstein/project-library-results/?project_sectors=architecture,urban-design&project_tags=all&submit= but if I do each of the project_sectors separately: http://localhost/Freelance/levitt-bernstein/project-library-results/?project_sectors=architecture&project_tags=all&submit= http://localhost/Freelance/levitt-bernstein/project-library-results/?project_sectors=urban-design&project_tags=all&submit= They both return the same result... If I output $sectors with just one it results as architecture but if I do it when I have two it wraps it in quotes "architecture,urban-design" which I don't know is of any help? Furthermore, I think we have to use | rather than a comma to separate our values, so instead of $sectors outputting "architecture,urban-design" it would output architecture|urban-design, yes? However, | gets removed when it is sanitised so I'd have to remove that? -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
I don't think multiple tags in the URL works? -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
And actually the default search does the same. So is %2C the correct thing for it to show in the URL? It's failing to bring back an item that has two project_sectors... -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
Thanks, man. It's good to know this going forward. Do you know why I get %2C in my URL once passed with the commas? -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
I meant to ask; if the user selects 'All', is there a value I can use for my project_sectors and/or project_tags that return them all? <?php $results = $pages->find("parent=/project-library/, sort=sort, project_sectors=$sectors, project_tags=$tags"); ?> -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
I see. Thanks so much for the help. -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
This is my full setup. The idea is that the input value will be updated per click via JS, so they click 'Landscape Design' it'll update the value to 'landscape design' etc. <form class="project-library-filter" action="<?php echo $pages->get('template=project-library-results')->url; ?>" method="get"> <input type="text" name="project_sectors" value="architecture,urban-design" /> <button type="submit" name="submit">Go</button> </form> On my template page for the results the following error is shown: Error: Exception: Unknown Selector operator: '=$' -- was your selector value properly escaped? (in /Users/rich/Sites/Freelance/levitt-bernstein/wire/core/Selectors.php line 281) <?php $sectors = $sanitizer->selectorValue($input->get->project_sectors); ?> <?php $tags = $sanitizer->selectorValue($input->get->project_tags); ?> <?php $results = $pages->find('parent=/project-library/, sort=sort, project_sectors=$sectors, project_tags=$tags'); ?> <?php foreach ($results as $result) : ?> <h1><?php echo $result->title; ?></h1> <?php endforeach; ?> Any thoughts? -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
Removed to clearer version below: -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
Ah yes, okay. So essentially this is very similar to the search setup on PW. But instead the action in the form would be a custom URL based on what they have selected, rather than a specific template. -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
Thanks @LostKobrakai. I have come up with the following: <?php $sectors = $sanitizer->selectorValue($input->get->project_sectors); ?> <?php $tags = $sanitizer->selectorValue($input->get->project_tags); ?> <?php $results = $pages->find('parent=/project-library/, sort=sort, project_sectors=$sectors, project_tags=$tags'); ?> <?php foreach ($results as $result) : ?> <h1><?php echo $result->title; ?></h1> <?php endforeach; ?> However, I'm unsure what the $input should be changed to? The URL, for example, could be: www.domain.com/project-library-results/?project_sectors=architecture&project_tags=education So, am I right in thinking that based on what the user selects, it will build a URL using JS, then on submit, take you to this page and the $input will find the relevant items from the URL and build the result based on this? -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
Thanks for this help. I can work out how I would return this as a page (so have this in my template) but I'm unsure how it would work having this as a filter with a submit button? Would it be as simple as front end JS to use the values to create a URL? Or would there need to be server side code? If someone selects the two filters and presses 'Go' how would it know which URL to go to? Using JS I am assuming? -
View multiple tags at any one time, rather than just one...
a-ok replied to a-ok's topic in General Support
Thanks again for your solution. I'm wondering if I can further enhance this more? See my screenshot: http://d.pr/i/18c1N Is it possible to create a submit so if the user selected architecture from the 'Show me' list and 'Education' from the 'For' list (which are two separate Page Fields) it would send them to a URL showing items with both sets applied? Is there any documentation available on something like this? Is it common? Thanks in advance. -
Hi folks, I've never had an issue like this but now when I go to upload an image to an image field I have setup on a page it states: ImageSizer::resize(0, 100) failed for /homepages/42/d264496819/htdocs/new/site/assets/files/1073/peterpaul_everyone22-1.0x100.jpg Any ideas what this could be related to? http://d.pr/i/1keCF+ It works fine on my local and only seems to be this page? I tried deleting the field and reinstating it... same issue.
-
Hi folks, I'm wondering if it is possible to create Previous/Next links between pages that only have a certain checkbox ticked? I have a Projects > each project structure setup, and if the user checks for a project to be a case study, it generates some new/different fields in the backend. What I'm after is to be able to have Previous/Next links per project that only cycles through the case studies... not all the projects. Here below is my code that works for ALL projects but not just CASE STUDY projects. Thanks for your time, R <?php /* $page->project_casestudy_check === 1 */ ?> <div class="project-casestudy-pagination-container clearfix"> <div class="container-fluid"> <div class="row"> <div class="col-xs-12 col-sm-12"> <?php if ($page->prev->id) : ?> <div class="prev-project-container"> <a class="prev-project" href="<?php echo $page->prev->url; ?>"><span>Previous Project</span></a> </div> <?php else : ?> <div class="prev-project-container"> <a class="prev-project" href="<?php echo $page->siblings->last->url; ?>"><span>Previous Project</span></a> </div> <?php endif; ?> <?php if ($page->next->id) : ?> <div class="next-project-container"> <a class="next-project" href="<?php echo $page->next->url; ?>"><span>Next Project</span></a> </div> <?php else : ?> <div class="next-project-container"> <a class="next-project" href="<?php echo $page->siblings->first->url; ?>"><span>Next Project</span></a> </div> <?php endif; ?> </div> </div> </div>
- 2 replies
-
- pages
- pagination
-
(and 2 more)
Tagged with:
-
Hi folks, I know how to get ONLY the first image from an Image field, but how to you exclude the first image? <?php foreach ($page->project_images->not()->first() as $image) : ?> Any thoughts? Sorry... just noticed slice in the cheatsheet... <?php foreach ($page->project_images->slice(1) as $image) : ?>
-
Mass create pages OR mass upload images and thus create pages
a-ok replied to a-ok's topic in General Support
This was great and was really what I was after... helped me loads. I made a few tweaks to add in dates and stuff but I really appreciate you helping me out there. Hopefully some other people can use this method too!- 12 replies
-
Mass create pages OR mass upload images and thus create pages
a-ok replied to a-ok's topic in General Support
I'm confused as I am unsure where to execute the module? Where do I upload the images? I couldn't find ImagesManager, @Soma.- 12 replies
-
Mass create pages OR mass upload images and thus create pages
a-ok replied to a-ok's topic in General Support
Thanks, BernhardB. I'm thinking a PHP query that writes each image from a folder into the DB, as it is a one-off scenario, and uses a similar structure to what you suggested. All the filenames have the year and title of the page, so for example: 2006_ALI.jpg should equal a page created called Ali, under the parent of 1026 and the date field should have the 2006 parent id in the DB for each page is 1026 title field in the DB is field_title (eg. Ali) date field in DB is field_works_date (eg. 2007) image field in the DB is field_works_image (eg. ocean_liner.jpg) What do you think? Possible?- 12 replies
-
Mass create pages OR mass upload images and thus create pages
a-ok replied to a-ok's topic in General Support
Thanks both! @BernhardB, I am unsure where to place this code?- 12 replies
-
Mass create pages OR mass upload images and thus create pages
a-ok posted a topic in General Support
Hi folks, This might be more a DB/mySQL question, perhaps, but thought I'd put it to the forum for discussion. I have a lot of pages to add to a certain section of my PW site. Portraits > Portrait 1 > Portrait 2 ... > Portrait 100 Each page has one image only. I am wondering if it is possible, if the image filenames and the titles of each 'page' are the same, if I can somehow mass upload these images to create pages from? Either through the backend or via the DB? So, for example: julian.jpg > Julian (page created with this image) kate.jpg > Kate (page created) ... mat.jpg > Mat (page created) This, of course, is only to save time... but wondered what you all thought? Or, even still, is it possible to mass create pages much like you can do with templates? Thanks for your time.- 12 replies