Jump to content

Search the Community

Showing results for tags 'category'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 8 results

  1. Hi! Is it possible to specify explicitly the parent section when creating a new child page with a single template? The idea is to save the user from the possibility of mistakenly choosing a section, but not to create unnecessary identical templates What I mean: Let's say I've got 2 parent categories with names articles & news. Each of them utilized the same admin-template (category) with the category.php file. Also, I have 2 different templates for child pages (article & news). Next, I need to add an article page to the articles category with the "create new" button in admin. At that moment, I must choose the category to place (because both categories use the same template). To runaround this (and create a page right into the exact category without the choosing step) I should create 2 templates for each category, and setup parent-children relations for each pair of templates, right? But Is any way to use only the one category template and different children templates and at the same time, explicitly specify which section to use for child pages, thereby removing the process of selecting a child section? articles (category.php) Article page 1 (page-article.php) Article page 2 (page-article.php) Article page 3 (page-article.php) + Add a new article page here without category chooser news (category.php) News page 1 (page-news.php) News page 2 (page-news.php) News page 3 (page-news.php) Update: found module but I can't get it work.
  2. How to FieldtypePage category as blog? Home - receptek - recept - recept - recept - kategorak - kategoria - kategoria - kategoria recept.php <?php foreach($page->kat_page as $item) { //$item = kategoria echo "<h3>$item->title</h3>"; //kategoria->recept??? }
  3. Hello my friends. Today I started working on my recipe website again and it was the turn to show recipes (pages) that has a specific category assigned in a field. In my NowKnow project for categories I used a parent page where inside of it I had the children and everything seemed to be super easy. This time, however, I decided to change the approach so I created a parent page Recipe categories and assigned to it my 'category' template. Inside the parent I added a few categories that I want to be able to select via PageReferrence field 'recipe_category'. The parent template would show all the categories represented by a title and an image - that part is done and works fine. Now what I am trying to achieve is to have a few recipes having the 'recipe_category' field equal to Bakery for example, and then when I point to the category URL to get only the recipes that have Breakfast selected in. From what I know the perfect approach to achieve that would be to use $input->urlSegment as to select the name of the category from the URL and then filter the pages adding to selectors: recipe_category=$category. Following Ryans earlier instructions about the urlSegment and an example found here in the forum, I got this code to fit my fields names: <?php if($input->urlSegment1 == 'category' && $input->urlSegment2) { $name = $sanitizer->pageName($input->urlSegment2); $category = $pages->get("template=categories-list, title=$name"); if($category->id) { $q = $pages->find("template=recipes-inner, recipe_category=$category"); } } ?> After adding the code, I enabled the URL segments for both: 'category' and 'category-list' templates. Browsing the URL for the Bakery category: http://food.pw/category/bakery/ (the domain name is not a typo, but PW is on my local server) I was supposed to get the $category to get the value of 'bakery'. However instead of that I am getting nothing. What am I missing in the big picture as I am sure it is again something silly but I spent almost the whole day trying to figure it out and still got no progress? P.S. trying to change the urlSegment number to 3 did not help either
  4. Hi, I'm quite sure to have read everything, doc and forums, about urlSegment, but I'm still not understanding how to use it. After have set my categories with this excellent post, I'm unable to fix url as I want. Page title | Template | actual url | url I want Categ-publi | parent_categ | categ-publi/article | publication/article -- Article | categories | Publication | basic-template | publication/example1 | publication/article/example1 -- example1 | publication | For which template I should activated urlSegment and in which template file I should add some code, probably something like this (which didn't work obviously)? if($input->urlSegment1 == 'publication') { echo $pages->get('/publication/$categ/')->render(); return; } else if($input->urlSegment1) { // throw a 404 throw new Wire404Exception(); } Thanks so much. Melanie
  5. Hi I read tons of posts/tutorials about categories and variations on the same subject. However, I think there is something I don't understand or just use a wrong design. Does someone could kindly explain where is my problem? Directory (basic-page template) -- Category (links template) --- Link 1 (repeater) I have no problem to output the content of the repeater on his own page of category. However, my problem is to list everything on the directory page. I suppose I can do a $page->find("template=links") but it make no sense to add that on a general basic-page template. Or do I should have a specific template for the parent page? Or some kind of function I can reuse? (I have the exact same problem for my gallery page with a category and their children) Thanks. Mel Links template $content .= $page->render('links'); /Fields/links function renderLinks($page) { foreach($page->links as $link) { echo "<h2><a href='{$link->http_link}'>{$link->title}</a></h2>"; echo "<p>{$link->summary}</p>"; echo "<p><a href='{$link->one_image->url}'><img src='{$link->one_image->url}' alt='{$link->one_image->description}' ></a></p>"; } } $content = renderLinks($page);
  6. Hey guys, So First Structure: Home [template=home] --Category [template=collection_list] ---SubCategory [template=collection_category] ----Articles [template=collection_basic] Each 'Articles' has a field called 'thumbnail' and 'banner'. I want to grab the latest article under a category and output the thumbnail and the banner. I'm quite new to PW (loving it so far) and I'm hoping you guys will be able to support me here.. I know it needs to look something like this... var_dump($pages->find("template=collection_basic, limit=1, sort=id")->thumbnail); ... Yes that's my var_dump but it's returning an error so. Would appreciate any help!
  7. Hello, I'm right now fighting to get content filtered by category. Maybe someone can help me... I have set up a hidden page area as filter option: - categories - cat 1 - cat 2 - cat 3 In some pages I'm able so select these categories as filters - work so far perfect. But: How can I filter the pages which have only the selected filters (categories)? I use the following code as the categories should always be shown: <?php $categories = $pages->find("template=category"); echo "<li>" . "<a href='{$page->url}'>All</a>" . "</li>"; foreach($categories as $category) { echo "<li>" . "<a href='{$category->name}'>{$category->title}</a>" . "</li>"; } ?> That shows me all the categories and a click of a category should show the filtered content - works so far but: If a category is clicked which has no pages -> no filter selected, all pages of the parent are shown instead of none. Any idea? Regards, Bacelo
  8. I'm creating a site to showcase project work from my students. I know this is a breeze with my conventional SQL database and ASP.NET tooling but hopefully I can work this out in Processwire. Can anyone comment on whether this plan holds water? Each Project has: Name Student members (1-4) n photos or videos or audio clips Obviously a page with a backing template with the appropriate field types works here. However, the members need to be selected from a separate list of Students. This suggests a PageReference field I reckon and a repeater to handle 1-4 Students. I have student details (ID & Name & Programme of Study & Yr of Study) in CSV file so guess I can generate pages from that file to create a collection of Students. I may want to filter Projects by 'Programme of Study' (from Student page). Should I create Student pages as a child page of 'Programme of Study' with maybe an in-between parent of 'Year of Study'? I might also permit access to the Project page only to those students who are members. So maybe setting Students up as users is the better way to go? I guess I'm looking for guidance around how to implement foreign key relations as you would normally do for a database. I'm guessing there are performance issues around the kind of querying I might want to do but there are hopefully some rules of thumb around establishing relations between entities (pages) in Processwire. Thanks, John
  • Create New...