HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Getting a date . . .

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#25488 (In Topic #5975)
Avatar

Community saint

NO, not that kind of date. But now that I have your attention, I need some help!!

I am trying to get the date to display in a header and I am using the following:

Code

<h4 class="standardbox_title_curved">Site Update Notes - ({$DATE})</h4>
but all it returns is - (Today) - and of course 'Today' never changes to the actual date when the day ticks over.

So, anybody got a fix for this?

 :(

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#25498
Avatar

As this renders the 'DATE' symbol useless, we'll consider this a bug.

Change line 443 of sources/symbols.php from:

Code

            $value=do_timezoned_date(time(),false);

Code

           $value=do_timezoned_date(time(),false,false,false,false,false,true);


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#25513
Avatar

Community saint

Thanks.

 :thumbs:

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#25562
Avatar

Community saint

Arrgghhh!

Now the date changes to the current date each time the page is opened. Also not what I had in mind. Back to the drawing board for me!

 :@

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#25574
Avatar

If you have a parameter being passed to the template you're editing which gives a timestamp, you could use the {$FROM_TIMESTAMP} Tempcode symbol to convert that into a human-readable date. :)

Back to the top
 
Posted
Rating:
#25583
Avatar

Community saint

Nope. That didn't do it. Here's what I have:

Code

<h4 class="standardbox_title_curved">Site Update Notes - ( [i]{$FROM_TIMESTAMP}[/i] )</h4>

All I get is an empty set of parentheses. At Least the $DATE gives me a date, but it looks like I'll need to revert to putting in the date manually. Bummer!!

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#25584
Avatar

What template is it that you are working with?


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#25585
Avatar

The reason it's giving a pair of empty parentheses is because you're not passing in the parameter to the symbol. The {$FROM_TIMESTAMP} symbol takes a parameter (the timestamp) from which it creates the date to be displayed. If you know which template in the parameter is the timestamp, you could enter it as follows: {$FROM_TIMESTAMP,{THE_PARAMETER}}, but if you give us the template name, we can work it out for you. :)

Back to the top
 
Posted
Rating:
#25588
Avatar

Community saint

I'm not actually using a 'pre-built' template. Just a bit of 'Amy-code' to build a curved box, but here is what I have, just in case you can see a solution . . .

Code

<div class="standardbox_curved" style="width: 100%">
<div class="standardbox_curved_title_left">
<div class="standardbox_curved_title_right">
<h4 class="standardbox_title_curved">Site Update Notes - ( [i]{$DATE}[/i] )</h4>
</div>
</div>
<div class="standardbox_inner_curved standardbox_main_classic">


<blockquote>
<p align="justify">The registered user count is approaching 100 and I have decided to build this page to bring all my visitors up to date with how the site conti . . . etc. etc. etc

Any help?

The {$DATE} is the closest I've come to having a post insert a date automatically. The alternative is to enter the date manually each time I make a post, and that isn't going to be much of a problem. So if this needs to be filed under 'irritation', then go ahead and do so. You won't find me shouting the odds!!

 :'(

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#25589
Avatar

So this is a Comcode page?

Back to the top
 
Posted
Rating:
#25591
Avatar

Community saint

Yes Philip. Linked from a left panel menu and editable via the CC edit link below the page . . .

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#25620
Avatar

This isn't supported, but I think you could do it, via some trickery.

EDIT_DATE_RAW is passed into the COMCODE_PAGE template. Whilst this isn't of direct help, because you are not using that template directly, you can try something sneaky. Try putting this into COMCODE_PAGE.tpl..

Code

{+START,SHIFT_ENCODE,this_page_date}{$FROM_TIMESTAMP,{EDIT_DATE_RAW}}{+END}
And then use {$SHIFT_DECODE,this_page_date} in your Comcode page.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#25642
Avatar

Community saint

Chris,

Tried all your 'trickery', but couldn't make it work.

Have reverted to 'Plan-A', and will continue to enter the date manually. No big deal as I shan't be making many entries for that page in any case.

Don't want to take this any further in case it impacts on other areas that I haven't seen. Perhaps when the site is up and running and stable, I will try some other experimentation in the same department. But not just yet.

Thanks for the effort so far.

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: