New Block for News Page?

Permalink
Hi,

I'm building a site for a client and he wants a news page on the site - title, date, article content.

I know he could do all those things with the existing content block, but I want to make things as foolproof as possible, so I'm wondering if creating a new block based upon the content block would be the best solution? What does the populus think?

If so, would it be a reasonably easy procedure to take a copy of the content block and edit it, adding two input fields above the textarea to allow the title and date to be entered (a calendar popup would be great but let's not run before I can walk!)

I realise it would probably mean creating a new database table. I'm no coder, but I'll give it a try!

Tony.

 
frz replied on at Permalink Reply
frz
I would make a page type of "news"
define the extra stuff they want as custom attributes...
then things like the page list block will still work, and if they want to add features to it over time, they can (like a guestbook or survey)
Fluvius replied on at Permalink Reply
Thanks for your advice frz.

Does this method mean you'd have each news item on a separate page?

Also, by adding Title and Date as Page Attribute fields, I assume the owner would have to put the page into edit mode to add a title and date to their news item. Is that correct?

I must admit how I initially envisaged the News section was one page with all the news items listed on it.

Any more advice on this is greatly appreciated.

Tony.
frz replied on at Permalink Reply
frz
Yeah, you would make a new page for each item, which admittedly is an extra step.

However you could customize the page list block so the end site viewer never gets to those detail pages but just displays one big list.

There are several advantages to this approach, which I agree seems a little backwards to begin with:

1) You can rearrange the articles easily using the sitemap and/sort by controls on page lists - a bunch of blocks in a single block area quickly become unweildly

2) You get easier preview/publish functionality and versions per news article if thats important.

3) You get the flexibility of using the page type as an object model. This might not be important in this case, but often once you realize what you /can/ do with other blocks on the page clients start to wonder "hey how could I add a comments section to each news item, or some photos?" If you take the extra time to make them pages in the first place the answer is "just add that block and enjoy".. if you go the custom block route, you end up rebuilding all that stuff inside your block..

that being said, yeah there are some times where just some text in a page makes sense.. thats how we deal with the /press page on this site for example..
Fluvius replied on at Permalink Reply
Hi Franz,

Thanks for your continuing advice, I'm gradually getting to grips with Concrete5 but I'd still term myself a novice.

After giving it some more thought I've decided that splitting the new items on to separate pages and linking to those pages from the main news section was a good idea, but there are a couple of things that I hope you can give me your advice on:

1) On the pages that list the full news items, is there a way to take the standard date and time (YYYY-MM-DD HH:MM:ss) and change it to display something like DD June YYYY at HH:MM:SS, basically rearranging the date ordering and changing the month number to the relevant word?
I see on the Press page that the date is listed as MM/DD/YY.
This is the code I'm using in my page type template to display the date/time:
<?php $date = $c->getAttribute('date'); print '<p>' . $date . '</p>'; ?>

Is there a better way of doing this (perhaps by using different code) or will I need to write a little routine to parse the $date variable and extract/alter it as necessary?

2) Staying on the subject of date/time, is there a way within the page list block to insert a date to be displayed below the news item's title? At the moment it lists the title and description for each news item.
I guess it will mean creating a template for that block?
If so where can I find the code to add that date field in to the template?

Thanks again for your indispensable advice and help, it's much appreciated.

Tony.
Remo replied on at Permalink Reply
Remo
there's an old feature request about something similar:
http://www.concrete5.org/community/features/custom_date_format...

as far as I know, there's not way to customize the date format yet.

You have to do it on your own. You don't need to extract every date part on your own, php does this, but it still takes a few lines of custom code
Fluvius replied on at Permalink Reply
Thanks for your combined help Franz and Remo,

I used:
<?php echo $c->getCollectionDateAdded('jS M Y'); ?>

which is working just great.

Thanks again,
Tony.
arothman replied on at Permalink Reply
arothman
I too am trying to create a custom 'news' block that stores and spits out the date and a paragraph or two of text.

I've been unable to figure out the exact method for storing the date when the new item was added to the page so that I can pull it back again later. Do you have more detail on exactly how you figured out storing and retrieving the date for a news page?

Is there a "news item" block written somewhere already? It seems like an almost obligatory thing for a website these days...

Thanks!
Drew
kutis replied on at Permalink Reply
kutis
was just install wordpress, and use the rss block to list it in the c5 site