Page 1 of 1

CGBlog summary view by category not displaying [solved ?]

Posted: Mon Dec 08, 2014 4:21 pm
by howey
Hi

I have set up CGBlog with a couple of categories. I am trying to show a summary view on the home page, but only showing one of the categories.

However when I use

Code: Select all

{CGBlog summarytemplate="promotion" detailpage="promotions" category="Promo" }
No articles show up, even though there are two test articles set with this category. If I remove category="Promo" from the tag it shows all the articles. I have tried this with other categories, changed category names etc no joy.

Summary template:

Code: Select all

{if isset($error)}{cgerror}{$error}{/cgerror}{/if}
{foreach from=$items item=entry}
<div class="homePromo1of2">
<div class="homePromoContent">
{if $entry->fields.mainimage}
    <img src="{$entry->file_location}/{$entry->fieldsbyname.mainimage->value}"/>
{/if}
<h3><a href="{$entry->detail_url}" title="{$entry->title|escape:htmlall}">{$entry->title|escape}</a></h3>
{if $entry->summary}
    {eval var=$entry->summary}
{else if $entry->content}
    {eval var=$entry->content}
{/if}
{if $entry->categories}
<div class="CGBlogSummaryCategory">
{strip}{$category_label}
 {foreach from=$entry->categories item='category'}
   {$category.name}&nbsp;
 {/foreach}
{/strip}
</div>
{/if}
</div>
</div>
{/foreach}
The template above prints out the category name OK, when the category="Promo" is removed from the tag. Again with the category="Promo" in the tag no articles are displayed.

CMSMS Version 1.11.11

CMS details
CGBlog 1.12.8
CGCalendar 1.14.4
CGExtensions 1.44.3
CGSimpleSmarty 1.7.4
CMSMailer 5.2.2
CMSPrinting 1.0.5
Captcha 0.5.0
FileManager 1.4.5
FormBuilder 0.8
JQueryTools 1.3.4
MenuManager 1.8.6
MicroTiny 1.2.7
ModuleManager 1.5.8
News 2.14.4
Search 1.7.11
ThemeManager 1.1.8

I am running a local development environment, MAMP Pro 2.2 and have tried switching between PHP 5.3.27 and 5.4.19 with no change.

CMS Config

php_memory_limit
process_whole_template
max_upload_size 32000000
url_rewriting none
page_extension
query_var page
image_manipulation_prog GD
auto_alias_content true
locale
default_encoding utf-8
admin_encoding utf-8
set_names true
debug false
timezone Europe/London
set_names true
set_names
root_url http://localhost:8888/foundation
ssl_url https://localhost:8888/foundation
root_path Success /Applications/MAMP/htdocs/foundation (0755)
previews_path /Applications/MAMP/htdocs/foundation/tmp/cache (0755)
uploads_path /Applications/MAMP/htdocs/foundation/uploads (0755)
uploads_url http://localhost:8888/foundation/uploads
image_uploads_path /Applications/MAMP/htdocs/foundation/uploads/images (0755)
image_uploads_url http://localhost:8888/foundation/uploads/images
ssl_uploads_url https://localhost:8888/foundation/uploads
use_smarty_php_tags

PHP

Current PHP Version (phpversion) 5.3.27
md5 function (md5_function) On (True)
GD version (gd_version) 2
tempnam function (tempnam_function) On (True)
Magic quotes in runtime (magic_quotes_runtime) Off (False)
Is E_STRICT disabled in error_reporting (E_STRICT) Success
Is E_DEPRECATED disabled in error_reporting (E_DEPRECATED) Success
PHP Effective Memory Limit (memory_limit) 32M
Maximum Execution Time (max_execution_time) 60
PHP output_buffering (output_buffering) On
PHP Safe Mode (safe_mode) Off (False)
File uploads (file_uploads) Success On (True)
Maximum Post Size (post_max_size) 32M
Maximum Upload Size (upload_max_filesize) 32M
Session Save Path (session_save_path) /Applications/MAMP/tmp/php (0775)
Sessions are allowed to use Cookies (session_use_cookies) On (True)
Basic XML (expat) support (xml_function) On (True)
Checking for the XMLReader class (xmlreader_class) On (True)
Checking if the httpd process can create a file inside of a directory it created (create_dir_and_file)
PHP register_globals (register_globals) Off (False)
disable_functions in PHP (disable_functions) Success
PHP Open Basedir (open_basedir) Success
Test for remote URL (test_remote_url) Success
fsockopen: Connection ok! Success
fopen: Connection ok! Success
Test ini_set (check_ini_set) On (True)
Test for the curl library (curl) On
Test curl version (curlversion) version 7.28.1, minimum recommended version is 7.19.7

Any help would be gratefully received.

Thanks

Re: CGBlog summary view by category not displaying

Posted: Wed Dec 10, 2014 4:16 am
by JohnnyB
Nice job supplying all of the site info and template stuff you are using.

I wonder if the category_id="" param will work? It is part of the CGBlog params but might not be in the help.
Or, try using a category id in the category="" param. The only reason I suggest that is because some of the CG module I've used will say use an alias but you can also use a content id instead, but undocumented.
{CGBlog summarytemplate="promotion" detailpage="promotions" category="Promo" }
Just a quick housekeeping question... Does your tag have a space before the closing brace? or is that a typo here?

THe reason I ask is because Smarty 3 uses whitespaces in tags differently than in version 2. Not sure if it applies but here is info from the smarty site:
In Smarty 2, you had to escape occurances of {} characters by surrounding them with {literal}{/literal} blocks or replacing them with {ldelim}{rdelim} tags. With Smarty 3, the braces will be ignored so long as they are surrounded by white space.

Re: CGBlog summary view by category not displaying [solved]

Posted: Wed Dec 10, 2014 9:55 am
by howey
Hi

thanks for the response. I tried category_id="" and that didn't work. However, using the category id in the category="" param worked, fingers crossed.

It's a pity the alias doesn't work. I am setting up several pages with different CGBlog entries. It's easier to remember the alias rather than the id, particularly as I add more categories. On the admin view is it possible to get the id number to display? I suppose I may be able to do this with the custom_module directory?

Thanks for the info on the closing brace
Just a quick housekeeping question... Does your tag have a space before the closing brace? or is that a typo here?
I hadn't in this case, but I have left a space before the closing brace in other tags, just being sloppy/makes it clearer to me what I have typed. I shall avoid this in the future. Although, it wasn't the culprit here.

Thanks again for the help, I would never have got there otherwise.

Re: CGBlog summary view by category not displaying [solved]

Posted: Wed Dec 10, 2014 11:14 am
by paulbaker
howey wrote:It's a pity the alias doesn't work.
It certainly should work, from CGBlog help:
(optional) category="" - Used in the summary, and archive views to display only items for the specified categories. Multiple categories can be used if separated with a comma. Leaving empty, will show all categories. This parameter also works for the frontend submit action, however only a single category name is supported.
I checked a 1.11.10 site with CGBlog 1.12.1. I changed

Code: Select all

{CGBlog}
in a page to

Code: Select all

{CGBlog category="Interior design"}
and got the correct subset of articles showing.

I wonder if it is your inclusion of summarytemplate= and/or detailpage= parameters that breaks it?

Sounds like it might be a bug:
http://dev.cmsmadesimple.org/bug/list/649

Re: CGBlog summary view by category not displaying [solved ?

Posted: Thu Dec 11, 2014 12:56 am
by applejack
Remove the blank space at the end.

Code: Select all

category="Promo" }

Re: CGBlog summary view by category not displaying [solved ?

Posted: Thu Dec 11, 2014 8:03 pm
by Dr.CSS
I don't think you are allowed/supposed to use the summarytemplate/detailtemplate with the category call as they will be ignored or some such...

Re: CGBlog summary view by category not displaying [solved ?

Posted: Thu Dec 11, 2014 9:40 pm
by applejack
Re: I don't think you are allowed/supposed to use the summarytemplate/detailtemplate with the category call as they will be ignored or some such...

Summarytemplate yes you are, same as New etc otherwise it wouldn't be much use.

Re: CGBlog summary view by category not displaying [solved ?

Posted: Fri Dec 12, 2014 2:08 am
by paulbaker
applejack wrote:Remove the blank space at the end.
It wasn't that, apparently:
http://forum.cmsmadesimple.org/viewtopi ... 36#p318236

Re: CGBlog summary view by category not displaying [solved ?

Posted: Fri Dec 12, 2014 11:50 am
by applejack
If it's having to use the category id number please submit this as a bug report and at the same time to make the catgeory call case insensitive as it used to be. (I would but I'm not running that version).

If this is a deliberate change then it's just dumb and made without consideration of users who actually make sites.