Page 1 of 1

CGBlog Browse Category path problem

Posted: Thu Jul 30, 2020 1:10 pm
by johnflan
I'm using CGBlog which is great but in the browse category listing the links created for all the categories includes the extra "admin/" and so of course takes you to the admin login page.

For example
"http://s773115261.websitehome.co.uk/bac ... s_cmssite/admin/index.php?mact=CGBlog,cntnt01,default,0&cntnt01browsecattemplate=Sample&cntnt01category_id=3&cntnt01returnid=0"

Has anyone got a fix for this please? Or an idea about where I need to look to sort it out.

I'm using the CGBlog browse category template "Sample".

Code: Select all

{* original browsecat template *}
{function cgblog_browsecat}
<ul>
  {foreach $categories as $cid => $rec}
    <li>
      {if $rec.count > 0}
      <a href="{$rec.url}" title="{$rec.name}">{$rec.name}</a>&nbsp;<em>({$rec.count})</em>
      {else}
        <span>{$rec.name}</span>&nbsp;<em>({$rec.count})</em>
      {/if}
      {if isset($rec.children)}
        {cgblog_browsecat categories=$rec.children}
      {/if}
    </li>
  {/foreach}
</ul>
{/function}

{cgblog_browsecat}

Re: CGBlog Browse Category path problem

Posted: Thu Jul 30, 2020 2:24 pm
by DIGI3
I wasn't able to recreate this behaviour, I tried various combinations of pretty and non-pretty urls. I would suspect it's something in your config.php or .htaccess causing it.

Re: CGBlog Browse Category path problem

Posted: Thu Jul 30, 2020 3:02 pm
by johnflan
Tried using .htaccess basic and as in the doc folder and also not using it at all and no change to the path.

The config file is basic.

Code: Select all

<?php
# CMS Made Simple Configuration File
# Documentation: https://docs.cmsmadesimple.org/configuration/config-file/config-reference
#
$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'xxxxxxxxx;
$config['db_username'] = 'xxxxxxxxx';
$config['db_password'] = 'xxxxxxxxx';
$config['db_name'] = 'xxxxxxxxx';
$config['db_prefix'] = 'cms_';
$config['timezone'] = 'Europe/London';
$config['cgblog_adminsection'] = 'content';
ini_set("memory_limit", "256M");
?>

I've tried lots of things and was hoping I had missed a setting or could add some code to make it use the correct path.

Re: CGBlog Browse Category path problem

Posted: Thu Jul 30, 2020 3:34 pm
by DIGI3
I can think of a few hacks or workarounds, but I think it must be something related to your configuration as I can't make it happen. I don't think it's necessarily a bug in the module.

The fact your install is in a subfolder might have something to do with it, but as you're not using pretty urls I'm not sure. What gets output when you add {root_url} to a page?

Also, just to make sure it's not some weird thing your browser or server config is doing, add a <pre>{$rec.url}</pre> to the foreach loop in the browsecat template to confirm what it's actually generating.

Re: CGBlog Browse Category path problem

Posted: Thu Jul 30, 2020 10:20 pm
by Dr.CSS
If it is in a subfolder are you using this..?

#Sub-dir e.g: /cmsms
RewriteBase /

Re: CGBlog Browse Category path problem

Posted: Thu Jul 30, 2020 11:38 pm
by johnflan
Dr CSS - Thank you - I'll look into the RewriteBase / surely it's got to be something like that. But, DIG13 - I think I'm closing in on something. Tried <pre>{$rec.url}</pre> and that was fine. Tried a lot of things in that direction, paths, server problems, setup and thought about re-installing.

Was getting desperate as it didn't make sense as the urls everywhere else were working, so just tried silly things and decided to change the CGBlog > Options tab > scrolling down to Summary View Options: and changed the Default Detail page from "None" to my page "Projects" and, it got rid of the admin/ in the path! It still linked to the "Home" page but at least it was linking to something in the website that I could work with.

Ok but here's the puzzling bit. To test it, I went back and changed the things I did {CGBlog action="browsecat" browsecattemplate="browsecat" detailpage:”projects”} and returned the CGBlog Options setting to None, None and the path is still good (without the admin/)! Weird.

And I'm using different browsers on different devices to check it.

Hmmm... what do you think was going on - could it be a server problem?

Re: CGBlog Browse Category path problem

Posted: Fri Jul 31, 2020 12:09 am
by DIGI3
More likely it just had a bad value stored for a default page so the module messed up when trying to calculate it. Setting it to something, then back to none, may have solved that. Or it's possible you typod on detailpage='xyz' (like you did in your post) or something similar.