Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Help & Support Intregating Date in Line Break Format
Duane
Posted on 27 May 2012, 03:27:02

Access: Member
Total Posts: 11
Joined: 2012-05-27

Good evening.

Being new to N-13 News and limited in my PHP includes, I'm having difficulty integrating N-13 News code/PHP includes into one of my templates. Below is a graphical example of what I wish to accomplish:

line break date

The issue I'm having is the line break between the month and the day. I don't know how to put it into the template. But I just can't figure out how to do this. BTW, I'm not having a problem with the general HTML/CSS. I can do that.

Any help would be appreciated.

Duane

#3864
Chris
Posted on 27 May 2012, 12:18:30

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Admin > Options > Settings > News > Date & time format for news:, change it to something like this %h<br />%d

Alternatively you can specify the time format when including your news like so

<?php
$newstimeformat = '%h<br />%d';
include 'news/index.php';
?>

See here http://code.google.com/p/n-13news/wiki/Integration

#3865
Duane
Posted on 27 May 2012, 13:43:43

Access: Member
Total Posts: 11
Joined: 2012-05-27

Thanks, Chris. I think I will need to be more complete in my explanation of my confusion. Here's what I want the full headline area to look like:

Here's the news area of my "Headline" template:

<div class="headlines">

     <div class="hldates">


     </div>

     <div class="hlcontent">

<a href="fullstory.php?id{id}" title="{title}">{title}</a><br />
{summary}<br />

     </div>

</div>

The "hldates" div will float left.

Here's my include for the webpage:

<?php
$template = 'Headlines';
include 'news/index.php';
?>

It seems to me that I can't just simply format the newstimeformat. I'm sorry that I'm so confused by this. It will click in soon I'm sure.

Thanks for your help.

Duane

#3866
Chris
Posted on 27 May 2012, 19:06:44

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Have you tried this?

<?php
$template = 'Headlines';
$newstimeformat = '%h<br />%d';
include 'news/index.php';
?>
#3867
Duane
Posted on 28 May 2012, 04:46:56

Access: Member
Total Posts: 11
Joined: 2012-05-27

Thanks, Chris, for working me through the process. I needed to add {date} to the template. I now see how it works. My apologies for my slowness,

#3868
Duane
Posted on 31 May 2012, 20:49:37

Access: Member
Total Posts: 11
Joined: 2012-05-27

Hi, Chris.

Would you clarify the $newstimeformat? You wrote the following:

$newstimeformat = '%h<br />%d';

When I check the PHP.net site, I understand the "h" to be "hour." Is there a better explanation somewhere? I would like to play with the different formats but have gotten various results based on the php.net site.

#3872
Chris
Posted on 31 May 2012, 21:07:40

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Have a look here - http://uk3.php.net/strftime

The way the news system formats your date/time is as follows.

By default the date is formatted depending on your system setting: Options > System > News > Date & time format for news:, which by default looks something like this %d/%m/%y %I:%M%p. If you look to the right of that input box you'll see a link called Date() which points to the above URL - http://uk3.php.net/strftime

If you don't specify the $newstimeformat when you include your news into your site, then the system setting is used.

Using the $newstimeformat variable when including your news, allows you to override the system default setting. This allows you to use different date/time formats with different templates.

#3873
Last edited by Chris at 2012-05-31 21:08:28 Reason: .
Network-13.com © 2013