Using Gallery module as a kind of blog tool – problems with text in Gallery image comments (line breaks etc)
I want to make a simple page for a client, that will work as a kind of newspage. It should be easy to add one image with a textblog. The latest added news/text should show at the top of the page.
I have made this page with the news module. But it doesn´t work for my client, as they dont know how to resize images. (!!)
So now I came up with the idea of making it with Gallery – using Lightbox template. I set the image size to a fixed size using the scale method.
I use the ”title” field for the headline of the news, the ”comment” field for the textarea.
But when you use line breaks in the text in the comment field, it wont show.
And html tags neither </br> though I want to avoid using html because of the client.
I would appreciate, if someone knows how to modify the comment field for images so I can use shift/line breaks?
Thanks a lot..
Marie
This is my Gallery template:
<div class="gallery">
{if !empty($gallerycomment)}<div class="gallerycomment">{$gallerycomment}</div>{/if}
{foreach from=$images item=image}
<div class="billeder">
<div class="image">
{if $image->isdir}
<img src="{$image-> thumb|escape:'url'|replace:'%2F':'/'}"
alt="{$image->title}" />
{else}
<img src="{$image->thumb}" alt="{$image->title}" />
{/if}
</div>
<div class="indhold">
{if !empty($image->titlename)}
<div class="titlename">{$image->titlename}</div>
{/if}
{if !empty($image->comment)}
<div class="imagecomment">{$image->comment}</div>
{/if}
</div>
<div class="galleryclear"> </div>
</div>
{/foreach}
</div>
How to make line breaks in text in Gallery image comments
Re: How to make line breaks in text in Gallery image comment
You know that there's a module that resizes images for you before showing them on a webpage?But it doesn´t work for my client, as they dont know how to resize images. (!!)
CGSmartImage http://dev.cmsmadesimple.org/projects/cgsmartimage.
Can be used within News templates and should actually always be used because you don't know what clients will upload.
Re: How to make line breaks in text in Gallery image comment
agree with velden that Gallery wouldn't be my first choice to use as a blog too, but to answer your question, this might work:
{$image->comment|nl2br}
{$image->comment|nl2br}
Re: line breaks in Gallery image comments /resize images in
Thank you very much Velden for pointing out this module.
Its installed.
I am interested in using {CGSmartImage filter_resize='w,400'}
My problem is that I don´t know where to put it in the summary template for the News module - I get too many {{
Perhaps you could tell me
This is the template:
<!-- Start News Display Template -->
{if $pagecount > 1}
<p>
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
{$nextpage} {$lastpage}
{/if}
</p>
{/if}
{foreach from=$items item=entry}
<div class="NewsSummary">
{if $entry->fieldsbyname.billede_left->value}
<div class="image_content_block">
<img src="{$entry->file_location}/{$entry->fieldsbyname.billede_left->value}" alt='' />
</div>
{/if}
<div class="indhold">
<div class="NewsSummaryLink">
{$entry->title|cms_escape}
</div>
{if $entry->summary}
<div class="NewsSummarySummary">
{eval var=$entry->summary}
</div>
{else if $entry->content}
<div class="NewsSummaryContent">
{eval var=$entry->content}
</div>
{/if}
</div>
</div>
{/foreach}
And talking about this module CGSmartImage, I am surprised that I didn´t found it before. I am looking for a forum or book where you find all the best information about modules and building websites .. for a novice like me. I'm sure I've lost a lot of documentation during the time I have been using CMSMS - for example about making a blog.
I would be happy to hear from other designers and novices in smarty tags like me, who can recommend more visual and pedagogical documentation about modules
THIS PART IS SOLVED:
And finally to Jos. Thanks a lot for your answer. It works!
I used it in the template for Gallery, and now line breaks is posible in Gallery image comments:
{if !empty($image->comment)}
<div class="imagecomment">{$image->comment|nl2br}</div>
{/if}
Marie
Its installed.
I am interested in using {CGSmartImage filter_resize='w,400'}
My problem is that I don´t know where to put it in the summary template for the News module - I get too many {{
Perhaps you could tell me
This is the template:
<!-- Start News Display Template -->
{if $pagecount > 1}
<p>
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
{$nextpage} {$lastpage}
{/if}
</p>
{/if}
{foreach from=$items item=entry}
<div class="NewsSummary">
{if $entry->fieldsbyname.billede_left->value}
<div class="image_content_block">
<img src="{$entry->file_location}/{$entry->fieldsbyname.billede_left->value}" alt='' />
</div>
{/if}
<div class="indhold">
<div class="NewsSummaryLink">
{$entry->title|cms_escape}
</div>
{if $entry->summary}
<div class="NewsSummarySummary">
{eval var=$entry->summary}
</div>
{else if $entry->content}
<div class="NewsSummaryContent">
{eval var=$entry->content}
</div>
{/if}
</div>
</div>
{/foreach}
And talking about this module CGSmartImage, I am surprised that I didn´t found it before. I am looking for a forum or book where you find all the best information about modules and building websites .. for a novice like me. I'm sure I've lost a lot of documentation during the time I have been using CMSMS - for example about making a blog.
I would be happy to hear from other designers and novices in smarty tags like me, who can recommend more visual and pedagogical documentation about modules
THIS PART IS SOLVED:
And finally to Jos. Thanks a lot for your answer. It works!
I used it in the template for Gallery, and now line breaks is posible in Gallery image comments:
{if !empty($image->comment)}
<div class="imagecomment">{$image->comment|nl2br}</div>
{/if}
Re: How to make line breaks in text in Gallery image comment
Example from a DETAIL template of mine:
Code: Select all
{if isset($entry->fields)}
{if !empty($entry->fields.foto->value)}
{CGSmartImage src="`$entry->file_location`/`$entry->fields.foto->value`" filter_resize='w,224' width='224' style='margin-left : -25px;'}
{/if}
{/if}[solved] to make line breaks in text in Gallery image comme
Great!! Thanks a lot!! This one is solved for now.
News template without CGSmartImage module:
{if $entry->fieldsbyname.billede_right->value}
<div class="image_content_block">
<img src="{$entry->file_location}/{$entry->fieldsbyname.billede_right->value}" alt='' />
</div>
{/if}
With CGSmartImage module:
<div class="image_content_block">
{if $entry->fieldsbyname.billede_right->value}
{CGSmartImage src="`$entry->file_location`/`$entry->fieldsbyname.billede_left->value`" filter_resize='w,400' width='400' alt=''}
{/if}
</div>
News template without CGSmartImage module:
{if $entry->fieldsbyname.billede_right->value}
<div class="image_content_block">
<img src="{$entry->file_location}/{$entry->fieldsbyname.billede_right->value}" alt='' />
</div>
{/if}
With CGSmartImage module:
<div class="image_content_block">
{if $entry->fieldsbyname.billede_right->value}
{CGSmartImage src="`$entry->file_location`/`$entry->fieldsbyname.billede_left->value`" filter_resize='w,400' width='400' alt=''}
{/if}
</div>




