News and Images
-
- Forum Members
- Posts: 30
- Joined: Wed Jun 22, 2005 8:02 am
News and Images
I have a request to see if it is possible to do. I haven't read anything on the forums that would do this but...
The news module has some lovely functionality, especially with the new trigger functionality between calendars etc. But one thing I think is missing is the ability to have one image (or two) as the illustration of the news story. At the moment I am relegated to inserting the news story and including the image itself into the text, albiet aligned left or right etc. I am looking to:
Insert a title, summary, body and dates etc like it does now, but also include a content block that would hold an image or series of images that I could work with css.
Then with the template I could do a:
{news item='image'}
{news item='summary,date,more_link'}
Effectively breaking apart the elements of the news to use in different ways, but say also having the latest news item on a home page, with only the image and link showing.
I hope this makes sense. I hope I have it in the right forum too.
The news module has some lovely functionality, especially with the new trigger functionality between calendars etc. But one thing I think is missing is the ability to have one image (or two) as the illustration of the news story. At the moment I am relegated to inserting the news story and including the image itself into the text, albiet aligned left or right etc. I am looking to:
Insert a title, summary, body and dates etc like it does now, but also include a content block that would hold an image or series of images that I could work with css.
Then with the template I could do a:
{news item='image'}
{news item='summary,date,more_link'}
Effectively breaking apart the elements of the news to use in different ways, but say also having the latest news item on a home page, with only the image and link showing.
I hope this makes sense. I hope I have it in the right forum too.
Re: News and Images
Hey there
I am currently looking for advice on how to achieve this too, found your post - got excited, then saw no responses...d'oh.
By replying I hope to get this thread higher up the list (does it work that way?). Anyway, to clarify, the news module (and the whole cmsms system) is excellent and saves my company so much time... but for a current job I need the client editors to be able to upload 2 images with the news, without having to insert them into a the summary or detail content blocks and mess about with alignment. Has anyone got any advice about how to add 2 extra content blocks to the news template? It would be much appreciated.
thanks
rhys
I am currently looking for advice on how to achieve this too, found your post - got excited, then saw no responses...d'oh.
By replying I hope to get this thread higher up the list (does it work that way?). Anyway, to clarify, the news module (and the whole cmsms system) is excellent and saves my company so much time... but for a current job I need the client editors to be able to upload 2 images with the news, without having to insert them into a the summary or detail content blocks and mess about with alignment. Has anyone got any advice about how to add 2 extra content blocks to the news template? It would be much appreciated.
thanks
rhys
Re: News and Images
Hi there, not sure if this will help or not.
Perhaps you can add two new {content block=} tags into the Detail template for the news?
For example, wherever you want the images to appear, you could specify in the Template.
Then using css to style the DIV location, you could add the 2 new content blocks, for example {content block="News Photo 1"} and {content block="News Photo 2"}
I haven't done this myself yet, but I'm thinking out loud while I type to see if it sounds feasible ...
Update - ok I just tried it, and yes I can add a DIV and style it, but of course when I add new News item, there is no way to access the new content/photo field.
I'm sure someone will know how to do this - Ted, are you around this weekend? Would this be major rewrites to do this?
Perhaps you can add two new {content block=} tags into the Detail template for the news?
For example, wherever you want the images to appear, you could specify in the Template.
Then using css to style the DIV location, you could add the 2 new content blocks, for example {content block="News Photo 1"} and {content block="News Photo 2"}
I haven't done this myself yet, but I'm thinking out loud while I type to see if it sounds feasible ...
Update - ok I just tried it, and yes I can add a DIV and style it, but of course when I add new News item, there is no way to access the new content/photo field.
I'm sure someone will know how to do this - Ted, are you around this weekend? Would this be major rewrites to do this?
Re: News and Images
I'm also looking for a good solution to this issue. At the moment I'm inlcuding a new class in the News stylesheet:
and calling it within the img link within the news content. However, a separate field in the add news form would be ideal.
Code: Select all
.NewsSummaryImage {
background: #ddd;
border: #d4d36b 8px solid;
display: inline-block;
float: left;
margin-right: 8px;
margin-bottom: 4px;
}
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
- Location: Deatsville, AL
Re: News and Images
I've just written a patch that adds an image selection dropdown for News Articles: http://dev.cmsmadesimple.org/tracker/in ... 8&atid=111
Download here: http://dev.cmsmadesimple.org/tracker/do ... 2-24.patch
Changed files here: http://www.elijahlofgren.com/uploads/mo ... -24.tar.gz
(If you don't have a program to uncompress .tar.gz, Filzip is good for that: http://www.filzip.com/en/index.html )
After applying the patch or changed files add this code to your summary and or detail News template where you want the image to appear:
If you want to look at the patch see here: http://www.cmsmadesimple.org/pastebin/809
Hope this helps,
Elijah
Download here: http://dev.cmsmadesimple.org/tracker/do ... 2-24.patch
Changed files here: http://www.elijahlofgren.com/uploads/mo ... -24.tar.gz
(If you don't have a program to uncompress .tar.gz, Filzip is good for that: http://www.filzip.com/en/index.html )
After applying the patch or changed files add this code to your summary and or detail News template where you want the image to appear:
Code: Select all
<img src="{$entry->icon}" alt="" />
Hope this helps,
Elijah
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: News and Images
Everything looks great except after adding the image code
and submitting the changes, the HTML editor (FCKeditorX and cbrte) changes the '>' character into '>':
(widgEditor renders it 'icon}">')
Thanks for the patch - this is most helpful!
Code: Select all
<img src="{$entry->icon}" alt="" />
Code: Select all
<img alt="" src="{$entry->icon}" />
Thanks for the patch - this is most helpful!
Re: News and Images
i just downloaded files and uploaded to my news directory nad almost everything wokrs fine, i have dropdown list and in admin it's ok, it even displays Current Picture, but when i paste this line to my summarytemplate like this icon}" alt="img" />
{$entry->icon} on page has no value, i mean its blank, like this What could be wrong with this ?
{$entry->icon} on page has no value, i mean its blank, like this What could be wrong with this ?
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
- Location: Deatsville, AL
Re: News and Images
Please paste your entire News Summary template here and I will try to take a look and see if I can see what's wrong.unnamed7 wrote: i just downloaded files and uploaded to my news directory nad almost everything wokrs fine, i have dropdown list and in admin it's ok, it even displays Current Picture, but when i paste this line to my summarytemplate like this icon}" alt="img" />
{$entry->icon} on page has no value, i mean its blank, like this What could be wrong with this ?
Also make sure you modified modules/News/action.default.php and added:
Hope this helps,Index: action.default.php
===================================================================
--- action.default.php (revision 150)
+++ action.default.php (working copy)
@@ -140,6 +140,7 @@
$onerow->author_id = $row['author_id'];
$onerow->author = $row['username'];
+ $onerow->icon = $row['icon'];
$onerow->authorname = $row['first_name'].' '.$row['last_name'];
$onerow->id = $row['news_id'];
$onerow->title = $row['news_title'];
Index: action.editarticle.php
===================================================================
Elijah
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: News and Images
great, works now, action.default was my problem, thanks for help 

- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
- Location: Deatsville, AL
Re: News and Images
Prompted by http://forum.cmsmadesimple.org/index.ph ... 783.0.html and an email I received, I've updated the patch to work with the latest version of the News module.
I've attached it to the same place that I posted the 1st one: http://dev.cmsmadesimple.org/tracker/in ... 8&atid=111
You can download it here: http://dev.cmsmadesimple.org/tracker/do ... r181.patch
If on Linux, you can apply it something like this:
However, most people don't run Linux and have no idea what I just did. 
If you are one of those people, you can download this zip file contain only the files that were changed:
http://www.elijahlofgren.com/uploads/mo ... 7-r181.zip
Then just copy all the files that are in the "News-add-image-dropdown-2007-06-17-r181" folder over the files in your modules/News folder.
After applying the patch or changed files add this code to your summary and or detail News template where you want the image to appear:
Enjoy,
Elijah Lofgren
I've attached it to the same place that I posted the 1st one: http://dev.cmsmadesimple.org/tracker/in ... 8&atid=111
You can download it here: http://dev.cmsmadesimple.org/tracker/do ... r181.patch
If on Linux, you can apply it something like this:
Code: Select all
elijahlofgren@kubuntu:~/www$ cd cmsmadesimple/modules/News
elijahlofgren@kubuntu:~/www/cmsmadesimple/modules/News$ patch -p0 < /home/elijahlofgren/cmsmadesimple/patches/modules/News/Add-Post-Image-Drop-Down-2007-06-17-r181.patch
patching file action.default.php
patching file action.editarticle.php
patching file lang/en_US.php
patching file News.module.php
patching file action.addarticle.php
patching file templates/editarticle.tpl

If you are one of those people, you can download this zip file contain only the files that were changed:
http://www.elijahlofgren.com/uploads/mo ... 7-r181.zip
Then just copy all the files that are in the "News-add-image-dropdown-2007-06-17-r181" folder over the files in your modules/News folder.

After applying the patch or changed files add this code to your summary and or detail News template where you want the image to appear:
Code: Select all
<img src="{$entry->icon}" alt="" />
Elijah Lofgren
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: News and Images
Hi Elijah, which version of the News module is that patch for? I've just looked at the original file News.module.php for 2.2 and the one you've patched and its got a lot of differences?
I got this error too...
Fatal error: Call to undefined method Event::RestrictUnknownParams() in /home/Ryan/public_html/modules/News/News.module.php on line 65
Thanks
Ryan
I got this error too...
Fatal error: Call to undefined method Event::RestrictUnknownParams() in /home/Ryan/public_html/modules/News/News.module.php on line 65
Thanks

Ryan
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
- Location: Deatsville, AL
Re: News and Images
Hi Zappa,Zappa wrote: Hi Elijah, which version of the News module is that patch for? I've just looked at the original file News.module.php for 2.2 and the one you've patched and its got a lot of differences?
I got this error too...
Fatal error: Call to undefined method Event::RestrictUnknownParams() in /home/Ryan/public_html/modules/News/News.module.php on line 65
Thanks
Ryan
Sorry, That patch was for the latest SVN of the News module (version 2.3), which comes with CMSMS 1.1
Here are the changed files for News 2.2 which comes with CMSMS 1.0.8: http://www.elijahlofgren.com/uploads/mo ... ws-2.2.zip
Hope this helps,
Elijah
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: News and Images
thanks a lot, this was exactly what i was looking for. and its working - almost perfect. ive got the dropdown box in news editing, and the image tag added to the template, and the image is there.
but whenever i edit an article, the edit page never stops loading. it looks like everything is loaded, but the status of the page is just "reading from..", and never "done". and to get a preview of the image ive chosen, i have to save the article, and re-open it.. is this how its supposed to be?
but whenever i edit an article, the edit page never stops loading. it looks like everything is loaded, but the status of the page is just "reading from..", and never "done". and to get a preview of the image ive chosen, i have to save the article, and re-open it.. is this how its supposed to be?
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
- Location: Deatsville, AL
Re: News and Images
I think this is caused by FCKeditor. I would try TinyMCE instead.geekus wrote: but whenever i edit an article, the edit page never stops loading. it looks like everything is loaded, but the status of the page is just "reading from..", and never "done".
I didn't add any fancy drop-down preview. I'm sure it wouldn't be too hard to make it changes the image when a new one is selected. Probably something like using onchange and something like this.getElementById('the_preview_image').src=dropdown.valuegeekus wrote: and to get a preview of the image ive chosen, i have to save the article, and re-open it.. is this how its supposed to be?
Just guessing though.

Have a great July 4th,
Elijah
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: News and Images
Hello, I have the same problem!Elijah Lofgren wrote:Please paste your entire News Summary template here and I will try to take a look and see if I can see what's wrong.unnamed7 wrote: i just downloaded files and uploaded to my news directory nad almost everything wokrs fine, i have dropdown list and in admin it's ok, it even displays Current Picture, but when i paste this line to my summarytemplate like this icon}" alt="img" />
{$entry->icon} on page has no value, i mean its blank, like this What could be wrong with this ?
Also make sure you modified modules/News/action.default.php and added:
Hope this helps,Index: action.default.php
===================================================================
--- action.default.php (revision 150)
+++ action.default.php (working copy)
@@ -140,6 +140,7 @@
$onerow->author_id = $row['author_id'];
$onerow->author = $row['username'];
+ $onerow->icon = $row['icon'];
$onerow->authorname = $row['first_name'].' '.$row['last_name'];
$onerow->id = $row['news_id'];
$onerow->title = $row['news_title'];
Index: action.editarticle.php
===================================================================
Elijah
I have uploaded files to my news directory and in admin panel everything works ok, but when I put: icon}" alt="img" /> in my template, html result is:
I,ve checked that in "action.default.php" is pasted: $onerow->icon = $row['icon'];" line. What could be wrong

Thanks for you reply!
