Need help getting images to show in CGBlog

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
seenoequal
Forum Members
Forum Members
Posts: 12
Joined: Tue Dec 23, 2014 9:11 pm

Need help getting images to show in CGBlog

Post by seenoequal »

Im currently working on a new look for my website. I have my results template layed out the way i want it, but i cant seem to get images to show.

To add a bit more detail, I am using cgblog to host music downloads from my site, these downloads all have associated images.

In cg blog i added a field definition and named it cover, this is where i upload the images.

In my cgblog template i use the following code to place my image

Code: Select all

<img src="{$entry->file_location}/{$entry->cover}"  alt="Artwork"/>
from what ive worked out

Code: Select all

{$entry->file_location}
calls the dir. path of my image and

Code: Select all

{$entry->cover}
calls the file name.

This works for me in cgblog.

However Id like my images to also show in my search results but the tags i was using work only in relation to the cgblog module.

at this point it may be worth mentioning that i have set my search to only pick up results from cgblog

so my question is, is there a way to make my search results pick up entries from other modules (cgblog)?

I am using CMS MADE SIMPLE 1.10.3 "Hyacinthe"

I hope ive added enough info to bring up a solution.
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Need help getting images to show in CGBlog

Post by staartmees »

First tip: update your cmsms asap to avoid security problems. Normally your version is no longer supported, http://forum.cmsmadesimple.org/viewtopi ... 40&t=30336
seenoequal
Forum Members
Forum Members
Posts: 12
Joined: Tue Dec 23, 2014 9:11 pm

Re: Need help getting images to show in CGBlog

Post by seenoequal »

Ok will do that sometime today, one thing I'm worried about is losing my things stored in cmsms modules, such as my articles etc, I have done a ftp backup but what about the rest? Will all of that stuff still be there after I upgrade?
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Need help getting images to show in CGBlog

Post by staartmees »

Always make a backup of your database before a major upgrade, http://docs.cmsmadesimple.org/upgrading ... nformation
seenoequal
Forum Members
Forum Members
Posts: 12
Joined: Tue Dec 23, 2014 9:11 pm

Re: Need help getting images to show in CGBlog

Post by seenoequal »

working on the upgrade situation, in the meantime are there any answers to my original problem?
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: Need help getting images to show in CGBlog

Post by Jeff »

seenoequal wrote: at this point it may be worth mentioning that i have set my search to only pick up results from cgblog

so my question is, is there a way to make my search results pick up entries from other modules (cgblog)?
Those two statements seem contradictory, if you want other modules then undo what you set to only pick up result from cgblog...more than likely I don't understand your question or problem. It might be helpful to provide a link to your site and include the templates that you are having problems with.
seenoequal
Forum Members
Forum Members
Posts: 12
Joined: Tue Dec 23, 2014 9:11 pm

Re: Need help getting images to show in CGBlog

Post by seenoequal »

@ Jeff, what i meant by that was id like for my search module to recognize the tag used for my images in the 'other module' cgblog..

to clarify..

I am using this tag to find my uploaded images in my cgblog module..

Code: Select all

<img src="{$entry->file_location}/{$entry->cover}"  alt="Artwork" class="size-3-4"/>
What im trying to achieve is for

Code: Select all

{$entry->file_location}/{$entry->cover}
from my cgblog module to be available as a parameter to use in my search results
pete290
Forum Members
Forum Members
Posts: 54
Joined: Sat Aug 22, 2009 5:55 pm

Re: Need help getting images to show in CGBlog

Post by pete290 »

You should install CGSmartimage and use something like this

{CGSmartImage src="{$entry->file_location}/{$entry->fieldsbyname.postimg->value}" filter_watermark=1 filter_croptofit="218,176,tc" class="prod_img"}
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm

Re: Need help getting images to show in CGBlog

Post by rotezecke »

these variables are not set. see for yourself. add this to your search template:

Code: Select all

{if $entry->module == "CGBlog"}
 {$entry|print_r}
{/if}

returns (in my case):
( [url] => http://xxxxxxx/leoch-agm-batteries.html
[urltxt] => Leoch AGM Batteries
[title] => Solar News Blog
[intweight] => 4
[module] => CGBlog
[modulerecord] => 142
[weight] => 100 )
so you need to create a simple detail template that shows the image (or more). then, inside your search result template's foreach loop, you need something like this:

Code: Select all

{if $entry->module == "CGBlog"}
{CGBlog articleid=$entry->modulerecord detailtemplate="the-image-only-template-you-just-made"}
{/if}
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Need help getting images to show in CGBlog

Post by velden »

pete290 wrote:You should install CGSmartimage and use something like this

{CGSmartImage src="{$entry->file_location}/{$entry->fieldsbyname.postimg->value}" filter_watermark=1 filter_croptofit="218,176,tc" class="prod_img"}
Though above code is not wrong, you might want to look at the help and read about the src1 and src2 parameter

Code: Select all

{CGSmartImage src1=$entry->file_location src2=$entry->fieldsbyname.postimg->value filter_watermark=1 filter_croptofit="218,176,tc" class="prod_img"}
seenoequal
Forum Members
Forum Members
Posts: 12
Joined: Tue Dec 23, 2014 9:11 pm

Re: Need help getting images to show in CGBlog

Post by seenoequal »

neither of those are working for me, it might be a good point to mention that my search entries all have open graph meta data which selects the right image for facebook etc,

maybe i could pull the meta image into my search results template. Is this possible if so anybody know how?
Though above code is not wrong, you might want to look at the help and read about the src1 and src2 parameter

Code:
{CGSmartImage src1=$entry->file_location src2=$entry->fieldsbyname.postimg->value filter_watermark=1 filter_croptofit="218,176,tc" class="prod_img"}
cgsmart image is new to me, all its doing when i add this tag is removing the css and leaving my page looking very plain. Can you elaborate on how this module calls my custom fields from cgblog?
seenoequal
Forum Members
Forum Members
Posts: 12
Joined: Tue Dec 23, 2014 9:11 pm

Re: Need help getting images to show in CGBlog

Post by seenoequal »

Post Reply

Return to “Layout and Design (CSS & HTML)”