Display block posting dates
Permalinki have recently buid a website using C5,http://www.dietdelightscenter.com
one of my client demand is to display the posting date under each testimonial in the testimonials page, knowing that each testimonials section is added using block
the link for this page is
http://www.dietdelightscenter.com/index.php?cID=125...
can you please help me how can i dispay the posted date of each block?
Thankyou in advanced
i have used the above code,
but its not seems to work!
the page is giving me this error "Fatal error: Call to a member function getBlockDateAdded() on a non-object in /home2/developa/public_html/dietdelightscenter.com/concrete/single_pages/dietdelights-testimonials1.php on line 44"
i am using the below code
<?php
$a = new Area('text in testimonials here');
$a->display($c);
$block->getBlockDateAdded()
?>
im a doing it the wrong way :(
any assistance on the above?
I'll see if I can give you a pointer. You've added your code to the wrong place.
It actually needs to go inside the block's view itself.
The general way of doing something like this is to create a custom template from the block's view and then add your custom code so you don't change the base block.
If you grab a copy of the view from your block and just look through it it might give you some clues.
Take a look at the following links:
http://www.concrete5.org/documentation/general-topics/custom-templa...
http://www.concrete5.org/documentation/how-tos/designers/change-how...
Remember though - you want to create a custom template - not actually change any of the block's code directly.
this was soo helpful
Regards
hello sorry for bringing this issue back,
but i have created the template perfectly fine, still something wrong with the code
i always get the message "Fatal error: Call to a member function getBlockDateAdded() on a non-object in ...."
my code is
<?php $block->getBlockDateAdded() ?>
can anybody provide me with the full php code?
or tell me whats wrong with mine?
Thanks
where did you put this code?
It's basically saying $block is not an object.
i have created a php file inside /blocks/content/templates/postdate.php
blocks folder was originaly empty
i was able to select "post date" from custom template in block editing,
but the problem is from the code itself, i am writing this code wrong!
can you provide me with the complete code?
kindly find below the view.php code inside concrete/blocks/content
kindly find below the postdate.php code inside /blocks/content/templates
<?php $block->getBlockDateAdded() ?>
Thanks
I think things are a little confused.
Which version of Concrete5 are you using?
the latest version
you can use
For more details you can get for blocks check out this post
http://www.concrete5.org/documentation/developers/blocks/working-wi...
or if this is a little too much maybe look to use one of these addons.
http://www.concrete5.org/marketplace/addons/-/view/?submit_search=1...