Forum

Thread tagged as: Problem, Runway, Blog

Problem showing blog posts in Runway

Hello,

I'm having some trouble showing blog posts in Runway.

The posts are imported from Wordpress and I ned to use the slug from the current site: "/post/{post-title}"

I have in Post Page Options

URL pattern: post/[slug:s]

in Blog Settings

Blog post page path: /post/{postSlug}

Slug format: {postTitle}

and in post.php

$post_slug = 'post/'.perch_get('s'); 
perch_blog_post($post_slug);

Now when I go to a blog post it renders everything except the post itself, so 'perch_blog_post($post_slug);' returns nothing.

Could you please let me know what am I dong wrong?

Debug Message
[12] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate FROM perch2_pages p LEFT JOIN perch2_page_routes pr ON p.pageID=pr.pageID ORDER BY pr.routeOrder ASC, p.pagePath ASC
Matched route: post/[slug:s]
Using master page: /templates/pages/blog/post.php
Page arguments:
Array
(
    [0] => /post/organizar-la-cocina-en-4-pasos
    [s] => organizar-la-cocina-en-4-pasos
    [1] => organizar-la-cocina-en-4-pasos
)
[1] SELECT * FROM perch2_pages WHERE pagePath='/post' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=26
[1] SELECT * FROM perch2_shop_cart WHERE cartID=26
[1] 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='_id' WHERE 1=1 AND ((idx.indexKey='postSlug' AND idx.indexValue='organizar-la-cocina-en-4-pasos')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey ) as tbl WHERE (postStatus='Published' AND postDateTime<='2016-08-15 16:02:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 10
[1] SELECT FOUND_ROWS() AS `count`
[36] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1] Using template: /templates/blog/meta_head.html
[2] SELECT * FROM perch2_blog_authors ORDER BY authorFamilyName, authorGivenName ASC
[1] SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC
[1] SELECT * FROM perch2_blogs ORDER BY blogTitle ASC
[36] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[3] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/post' LIMIT 1
[1] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-004', '000') ORDER BY pageTreePosition DESC
[3] Using template: /templates/navigation/item.html
[nil] 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='_id' WHERE 1=1 AND ((idx.indexKey='postSlug' AND idx.indexValue='post/organizar-la-cocina-en-4-pasos')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey ) as tbl WHERE (postStatus='Published' AND postDateTime<='2016-08-15 16:02:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 10
[1] SELECT FOUND_ROWS() AS `count`
Using template: /templates/blog/post.html
Fetching from cache: perch_blog_author_for_post01cef70fecdf52f163eb9d54ae0ba212
Cache file not found: perch_blog_author_for_post01cef70fecdf52f163eb9d54ae0ba212
[1] SELECT * FROM perch2_blog_posts WHERE postStatus='Published' AND postDateTime<='2016-08-15 16:02:00' AND postSlug='post/organizar-la-cocina-en-4-pasos'
Debug Message
[12] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate FROM perch2_pages p LEFT JOIN perch2_page_routes pr ON p.pageID=pr.pageID ORDER BY pr.routeOrder ASC, p.pagePath ASC
Matched route: post/[slug:s]
Using master page: /templates/pages/blog/post.php
Page arguments:
Array
(
    [0] => /post/organizar-la-cocina-en-4-pasos
    [s] => organizar-la-cocina-en-4-pasos
    [1] => organizar-la-cocina-en-4-pasos
)
[1] SELECT * FROM perch2_pages WHERE pagePath='/post' LIMIT 1
[1] SELECT * FROM perch2_shop_cart WHERE cartID=26
[1] SELECT * FROM perch2_shop_cart WHERE cartID=26
[1] 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='_id' WHERE 1=1 AND ((idx.indexKey='postSlug' AND idx.indexValue='organizar-la-cocina-en-4-pasos')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey ) as tbl WHERE (postStatus='Published' AND postDateTime<='2016-08-15 16:02:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 10
[1] SELECT FOUND_ROWS() AS `count`
[36] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1] Using template: /templates/blog/meta_head.html
[2] SELECT * FROM perch2_blog_authors ORDER BY authorFamilyName, authorGivenName ASC
[1] SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC
[1] SELECT * FROM perch2_blogs ORDER BY blogTitle ASC
[36] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[3] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 AND pageDepth >=0 AND pageDepth<=1 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/post' LIMIT 1
[1] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-004', '000') ORDER BY pageTreePosition DESC
[3] Using template: /templates/navigation/item.html
[nil] 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='_id' WHERE 1=1 AND ((idx.indexKey='postSlug' AND idx.indexValue='post/organizar-la-cocina-en-4-pasos')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey ) as tbl WHERE (postStatus='Published' AND postDateTime<='2016-08-15 16:02:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 10
[1] SELECT FOUND_ROWS() AS `count`
Using template: /templates/blog/post.html
Fetching from cache: perch_blog_author_for_post01cef70fecdf52f163eb9d54ae0ba212
Cache file not found: perch_blog_author_for_post01cef70fecdf52f163eb9d54ae0ba212
[1] SELECT * FROM perch2_blog_posts WHERE postStatus='Published' AND postDateTime<='2016-08-15 16:02:00' AND postSlug='post/organizar-la-cocina-en-4-pasos'
Request time: 0.0348
Process time: 0.0335
Memory: 1.745
Proko Mountrichas

Proko Mountrichas 3 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think you want to prepend post/ onto the slug. Use:

perch_blog_post(perch_get('s'));

Correct, thanks!

This is what happens when you try "everything" but not in the right order.