Also, when I preview a draft, the preview page is completely unstyled. I cant find anything in documentation that tells me how the preview page is generated so I can make it look like a proper page.
Hi Chris, to output the list of categories as a select list that links to the archive page showing all blogs with that category, you should be able to use something like this:
<!--* Replace YOUR_ID and YOUR_CATEGORY_SET with your values *-->
<perch:categories id="YOUR_ID" set="YOUR_CATEGORY_SET" label="Categories" >
<perch:before>
<!--* ONCHANGE makes the browser go to the selected page *-->
<select ONCHANGE="location = this.options[this.selectedIndex].value;">
<option value="" selected="selected">Select</option>
</perch:before>
<!--* if your archive page is in the same directory *-->
<option value="archive.php?cat=<perch:category id="catPath" />"><perch:category id="catTitle" /></option>
<perch:after>
</select>
</perch:after>
</perch:categories>
OK I now have this, but its not working. Not showing anything at all
<!--* Replace YOUR_ID and YOUR_CATEGORY_SET with your values *-->
<perch:categories id="select_list" set="blog" label="Categories" >
<perch:before>
<!--* ONCHANGE makes the browser go to the selected page *-->
<select ONCHANGE="location = this.options[this.selectedIndex].value;">
<option value="" selected="selected">Select</option>
</perch:before>
<!--* if your archive page is in the same directory *-->
<option value="archive.php?cat=<perch:category id="catPath" />"><perch:category id="catTitle" /></option>
<perch:after>
</select>
</perch:after>
</perch:categories>
Debug Message
Search term:
Using template: /templates/search/search-result.html
SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='postDateTime' WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue ) as tbl WHERE (postStatus='Published' AND postDateTime<='2016-01-28 22:25:00' ) GROUP BY itemID, sortval ORDER BY sortval DESC LIMIT 0, 8
SELECT FOUND_ROWS() AS `count`
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Using template: /templates/blog/post_in_list.html
SELECT * FROM perch2_blog_authors ORDER BY authorFamilyName, authorGivenName ASC
SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC
SELECT * FROM perch2_blogs ORDER BY blogTitle ASC
SELECT setID FROM perch2_category_sets WHERE setSlug='blog' LIMIT 1
SELECT main.* FROM perch2_categories main WHERE 1=1 AND setID=1 ORDER BY catTreePosition ASC
Using template: /templates/categories/blog_select_list.html
Using template: /templates/search/search-form.html
SELECT DISTINCT idx.itemID FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' AND (idx.indexKey='_category' AND idx.indexValue LIKE 'blog/next-meeting/%' OR idx.indexKey='_category' AND idx.indexValue='blog/next-meeting/')
SELECT DISTINCT idx.itemID FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' AND (idx.indexKey='_category' AND idx.indexValue LIKE 'blog/main-featured/%' OR idx.indexKey='_category' AND idx.indexValue='blog/main-featured/')
SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='postDateTime' AND idx.itemID IN ('16', '35', '36') AND idx.itemID NOT IN ('1', '39') WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue ) as tbl WHERE (postStatus='Published' AND postDateTime<='2016-01-28 22:25:00' ) GROUP BY itemID, sortval ORDER BY sortval DESC LIMIT 0, 1
SELECT FOUND_ROWS() AS `count`
Using template: /templates/blog/sidebar-post-in-list.html
SELECT DISTINCT idx.itemID FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' AND (idx.indexKey='_category' AND idx.indexValue LIKE 'blog/next-meeting/%' OR idx.indexKey='_category' AND idx.indexValue='blog/next-meeting/') OR (idx.indexKey='_category' AND idx.indexValue LIKE 'blog/main-featured/%' OR idx.indexKey='_category' AND idx.indexValue='blog/main-featured/') OR (idx.indexKey='_category' AND idx.indexValue LIKE 'blog/previous-meetings/%' OR idx.indexKey='_category' AND idx.indexValue='blog/previous-meetings/')
SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='postDateTime' AND idx.itemID NOT IN ('1', '25', '26', '29', '31', '32', '39', '17', '34', '37', '38', '16', '35', '36') WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue ) as tbl WHERE (postStatus='Published' AND postDateTime<='2016-01-28 22:25:00' ) GROUP BY itemID, sortval ORDER BY sortval DESC LIMIT 0, 1
Using template: /templates/blog/sidebar-post-in-list.html
SELECT DISTINCT idx.itemID FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' AND (idx.indexKey='_category' AND idx.indexValue LIKE 'blog/previous-meetings/%' OR idx.indexKey='_category' AND idx.indexValue='blog/previous-meetings/')
SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='postDateTime' AND idx.itemID IN ('17', '37', '38') WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue ) as tbl WHERE (postStatus='Published' AND postDateTime<='2016-01-28 22:25:00' ) GROUP BY itemID, sortval ORDER BY sortval DESC LIMIT 0, 1
Using template: /templates/blog/sidebar-post-in-list.html
You don't need the <perch:categories></perch:categories> tag pair when you're in a category template. Those are used for seconding categories into other types of templates.
Something like this should work:
<perch:before>
<!--* ONCHANGE makes the browser go to the selected page *-->
<select ONCHANGE="location = this.options[this.selectedIndex].value;">
<option value="" selected="selected">Select</option>
</perch:before>
<!--* if your archive page is in the same directory *-->
<option value="archive.php?cat=<perch:category id="catPath" />"><perch:category id="catTitle" /></option>
<perch:after>
</select>
</perch:after>
What have you got so far?
Clearly, I have little clue how to do this!
Also, when I preview a draft, the preview page is completely unstyled. I cant find anything in documentation that tells me how the preview page is generated so I can make it look like a proper page.
Hi Chris, to output the list of categories as a select list that links to the archive page showing all blogs with that category, you should be able to use something like this:
perch_blog_custom()
outputs posts, so that may not be what you want if you want a list of categories.Thank you guys - I'll take a look and see how I get on with this
OK I now have this, but its not working. Not showing anything at all
I have just one set, 'blog' in my categories.
What do you get if you turn on debug for that page?
https://docs.grabaperch.com/docs/installing-perch/configuration/debug/
It gives this
You don't need the
<perch:categories></perch:categories>
tag pair when you're in a category template. Those are used for seconding categories into other types of templates.Something like this should work:
Thanks Drew this works great.
Just one last quick question, how do I exclude certain categories from appearing on the list?
You can use filter options on
perch_categories()
, and you can also test for items in the template withperch:if