• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: CGBlog images not showing in detail template on default page
PostPosted: Tue Jun 12, 2018 10:48 am 
Offline
Forum Members
Forum Members
User avatar

Joined: Fri Sep 14, 2007 1:05 pm
Posts: 140
Location: South Derbyshire – UK
Hi

A conundrum? I have CGBlog installed and have a page that has a main tag in the content block

Code:
{CGBlog detailtemplate="00_newsdetail" detailpage="latest-news" number="1" category="General" action="detail"}


Which should show the latest post.

I then have a tag in a content block forming the right hand column which gives a list of posts.

Code:
{CGBlog summarytemplate="00_newspagesummary" detailpage="latest-news" number="5" category="General" detailtemplate="00_newsdetail"}


Both use the same detail template. However when you navigate to the page the post in the main content shows up with the text, but the images don't show. If I then click on the link in the right hand column the images do show?

I am using the following code to select the appropriate image.

Code:
{if isset($entry->fields)}
  {foreach $entry->fields as $field}
    {if $field->type == 'image' && $field->name == 'Standard Image' && $field->value != ''}
{capture name=newsdetailimg assign=standardnews}{CGSmartImage src1=$entry->file_location src2=$field->value  max_width="1000" max_height="800" class="img-responsive" noembed=1 alt=$entry->title}{/capture}
    {/if}
  {/foreach}
{/if}

{if isset($entry->fields)}
  {foreach $entry->fields as $field}
    {if $field->type == 'image' && $field->name == 'Revolving image' && $field->value != ''}
{capture name=newsdetailimg2 assign=revolvingnews}{CGSmartImage src1=$entry->file_location src2=$field->value  max_width="1000" max_height="800" class="img-responsive" noembed=1 alt=$entry->title}{/capture}
    {/if}
  {/foreach}
{/if}

{if $standardnews != ''}
    {$standardnews}
    {elseif $revolvingnews != ''}
    {else}---
{/if}


I think it is probably something to do with the way the page is processed. I seem to think that this might be a resent change. Although I can't remember the administrator says the images used to show?

I have tried just calling the image directly without the capture, but the result is the same.

I am running 2.2.7 with all the latest associated modules. PHP version 5.5.38. The only resent changes are upgrade to 2.2.7 and installation of CG content utilities.

Any help would be gratefully received.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBlog images not showing in detail template on default
PostPosted: Tue Jun 12, 2018 2:46 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 444
Location: Victoria, BC
If the output of the captured variables isn't in the same template, you need to give them a global scope.

So after the captures, you could add:
Code:
{$standardnews=$standardnews scope=global}
{$revolvingnews=$revolvingnews scope=global}


Note: I think there are better and more efficient ways to do what you're doing, but that should at least determine if it's a scope issue.

_________________
Not getting the answer you need? CMSMS support options


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBlog images not showing in detail template on default
PostPosted: Tue Jun 12, 2018 2:48 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3013
Location: The Netherlands
My first step would be to just print the contents of the fields to the page. To check if that works.

Put this code somewhere in the top of the detail template you use and then check on the frontend if it has the values as you expect.
Code:
<pre>{$entry->fields|print_r}</pre>



Further, it's not very efficient to iterate to 'all' fields twice only to find one value, which you already know where to search for it.
You already know the name, you know the field is of type image, so you only want to check if it's not empty

Code:
{if $entry->fields['<FIELD_NAME>']->value != ''}
...
{/if}


(note: I don't know if CGBlog uses field ALIASES in stead of NAMES. You can check this in the output of the earlier mentioned {$entry->fields|print_r})

Then, {capture} is said to be expensive. So you might consider to use assign.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBlog images not showing in detail template on default
PostPosted: Tue Jun 12, 2018 6:50 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7571
Location: The Netherlands
Smarty scope code examples at http://cms.ms/Hupy

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBlog images not showing in detail template on default
PostPosted: Tue Jun 19, 2018 2:17 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Fri Sep 14, 2007 1:05 pm
Posts: 140
Location: South Derbyshire – UK
Hi

I am still struggling with this.

I have tried the various suggestions:

Code:
{$standardnews=$standardnews scope=global}
{$revolvingnews=$revolvingnews scope=global}


Which didn't make any difference.

I added the
Code:
<pre>{$entry->fields|print_r}</pre>


Which didn't print a list of fields in the news page (I'm using CGBlog instead of the News module as it has more flexibility in the categories etc.) when you navigated straight to that page, it just displayed the number 1. But when you click on a "news" story in the right column it then displayed the full set of fields?

As the CGBlog tag is added in the default content block on the page

Code:
{CGBlog detailtemplate="00_newsdetail" detailpage="latest-news" number="1" category="General" action="detail"}


I'm assuming it's not processing all the fields. But I am not sure how to make these "variables" available when just navigating to the page, rather than click on a CGBlog story to get the detail.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBlog images not showing in detail template on default
PostPosted: Tue Jun 19, 2018 4:22 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3013
Location: The Netherlands
I would suggest to hire someone to check it out for you. Can't imagine it takes longer than half an hour to find the culprit and come up with a working solution.

If that's not an option post the full page template and full detail template. Further post the name of the content blocks and their contents.

An url to the resulting page would help too probably.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBlog images not showing in detail template on default
PostPosted: Tue Jun 19, 2018 6:18 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7571
Location: The Netherlands
Did you follow/read this blog too? http://cms.ms/JntZ
Note the way the content blocks are installed!

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBlog images not showing in detail template on default
PostPosted: Tue Jun 19, 2018 8:08 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7571
Location: The Netherlands
Ohw, this blog is also describing a similar situation http://cms.ms/yovH

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBlog images not showing in detail template on default
PostPosted: Thu Jun 21, 2018 9:36 am 
Offline
Forum Members
Forum Members
User avatar

Joined: Fri Sep 14, 2007 1:05 pm
Posts: 140
Location: South Derbyshire – UK
Hi

Thanks Rolf, from first read that appears to be where the solution lies.

I'm always interested to learn new things where I think I should be able to understand the problem or it fits within my scope of experience. If we stop learning we might as well give up. It's great to get support from the forum.

However, there are times when I have paid for additions and help Velden. I have supported these enhancements so that they can be included in the CMS core. I think we can all benefit from a thriving community.

Know for more head scratching!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: CGBlog images not showing in detail template on default
PostPosted: Thu Jun 21, 2018 10:51 am 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3013
Location: The Netherlands
Quote:
However, there are times when I have paid for additions and help Velden. I have supported these enhancements so that they can be included in the CMS core. I think we can all benefit from a thriving community.


Sure, no problem of course. I didn't know whether you were facing a deadline or something.

Posting the templates could really help as the order of things may be important in this case.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting