Page 1 of 1

CGBlog image file not showing [solved]

Posted: Fri Jun 14, 2013 10:35 am
by howey
Hi

Any help advice appreciated.

I have installed CGBlog, and added extra fields, one of which is an image field. I have used the default sample detail template, but this doesn't show the image field. It is almost as if the field type, file, isn't working. The image value is shown in the list of extra fields with it's field name. (I did a test and hadn't altered the template at all)

So, I created a template and used this code instead of the default:

Code: Select all

{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}

        {if $field->name == 'Picture'}
          <img src="uploads/cgblog/id{$entry->id}/{$field->value}"/>
        {/if}

  {/foreach}
{/if}
and this worked.

I'm running the latest CMSMS 1.11.7 “Genovesa” with all modules up-to-date:

CGBlog 1.9.12
CGExtensions 1.35
CGSimpleSmarty 1.6.2
CGSmartImage 1.10.10
CMSMailer 5.2.1
CMSPrinting 1.0.4
FileManager 1.4.3
FormBuilder 0.7.3
MenuManager 1.8.5
MicroTiny 1.2.5
ModuleManager 1.5.5
News 2.12.12
Search 1.7.8
ThemeManager 1.1.8

Current PHP Version 5.3.2
everything is ticked apart from E_Deprecated, which is enabled.

Running on a local MAMP solution.

Thanks for any help.

PS. When I click on the module in the admin, everything seems fine. But when I try and navigate to a separate section it seems to freeze. I have given the module a friendly name of "Case Studies"

PPS: I have changed the options to:
URL template to just
{$title}
and
Prefix to use on all URLs to "case_studies"

Although I am not using pretty urls at this moment

Re: CGBlog image file not showing

Posted: Wed Jun 19, 2013 9:56 pm
by polodesign
Hi Howey,

I found the same problem today with the blog image. Change

Code: Select all

{if $field->type == 'file'}
to

Code: Select all

{if $field->type == 'image'}
and the image will then show up.

Your solution works well for calling a single image field, particularly when you have more than one image field.

You can also try this, which doesn't require the 'if isset' or the foreach call:

Code: Select all

{if $entry->fields.yourfieldname}
Have you been able to solve your other issue? I've never had a problem with changing the friendly name. Did you try switching back to the default to see if that is causing the freezing problem?

Cheers,
Penny

Re: CGBlog image file not showing

Posted: Thu Jun 20, 2013 8:02 am
by howey
Hi

Thanks, I'll try the =='image' and fieldname solutions. A little neater than my solution.

I changed the friendly name back to default but I am still getting some odd behaviour. When in CGBlog and I click on a link/section outside the immediate "content" section ie "layout" nothing happens, but if I click another section within the "content" section ie "pages" the link works and I can then nav to any other section. This also works if I click on any link outside the immediate menu ie "home". This only happens in the admin theme oneeleven, not in NCleanGrey!

Is this post solved? I'm not sure, I have work arounds in place, but the core functionality is still a little adrift.

Re: CGBlog image file not showing

Posted: Fri Jun 21, 2013 8:16 pm
by Rolf
You can call the field direct with something like

Code: Select all

{$entry->fieldsbyname.your_field_name->value}

Re: CGBlog image file not showing

Posted: Fri Jun 21, 2013 9:05 pm
by polodesign
Howey, I wonder if your 'freezing' problem might be with jQuery in the admin area, which is used by the OneEleven theme. I have a similar problem with one of my clients who is hosted elsewhere and I assume that jQuery is the cause (although I have not checked with the host); I just keep their admin in the NCleanGrey theme. You might check with the host to see if that's the case and whether they can change it.

I'd be interested to know if anyone else has experienced this.

cheers,
Penny

Re: CGBlog image file not showing

Posted: Fri Jun 21, 2013 10:29 pm
by paulbaker
howey wrote:When in CGBlog and I click on a link/section outside the immediate "content" section ie "layout" nothing happens
This happens with my hosting when I set up a new site. I get support to whitelist the mod_security rule 950004 and all is well. Might be worth a try in your case. Might help you too, Penny?

Re: CGBlog image file not showing

Posted: Sat Jun 22, 2013 2:03 am
by polodesign
Thanks Paul - I'll check into that.

Re: CGBlog image file not showing

Posted: Sat Jun 22, 2013 9:47 pm
by Rolf