I'm trying to get article's created timestamp or date so I can format it with css. I've searched on google and on the forum but, I'm confused on the result.
I've done this:
echo $this->article->created;
echo $this->item->created;
And is giving me a blank result.
What am I doing wrong?
Looking at the page layout
https://github.com/joomla/joomla-cms/blob/2.5.x/components/com_content/views/article/tmpl/default.php#L114
Line 114 you see how the date is rendered in 2.5.
<dd class="create">
<?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $this->item->created, JText::_('DATE_FORMAT_LC2'))); ?>
</dd>
So to style it you can just use the create class or you can make a layout override.
This is assuming you want it in an article. If you want it in a list or something look at the appropriate layout for that. And if you want to override the date format itself do that in a layout override.
The element you want seems to vary by version, so make sure whatever you are cribbing off of, matches your installation.
First of All where you are trying to display the created date.
1) In normal article views like default joomla catgory ,blog or any other view.
You should check the following.
The article options that available on the right side options of articles the created date is show true.
Then Also make sure If it assigned to a menu there also these options available there also
make true.
Then you will get the created date in the articles default view.
2)If you are trying with a custom code section you can find some codes like this.
$useDefList = (($params->get('show_author')) OR ($params->get('show_category')) OR ($params->get('show_parent_category'))
OR ($params->get('show_create_date')) OR ($params->get('show_modify_date')) OR ($params->get('show_publish_date'))
OR ($params->get('show_hits')));
on the article default view of joomla.In any version of joomla these should be based on article options values.
Hope this may help you...
Related
I need to get some attributes from the main article of an article variant. An example:
The user got article SW1234.4 selected. The shop should show the attribute "test" from the main article SW1234 and not from the variant SW1234.4.
I´m thinking about some smarty var with {$sArticle.mainnumber.attr4}
How is this possible?
you should try "{debug}" at first. (Enable popups!)
Now you can see which variables you have access to, maybe the information you are looking for is already stored in a smarty variable.
The Other way would be a custom Plugin which does a select on your articles table and gets the desired information which you than can assign to your view.
e.g.
$this->View()->assign($varname, $value);
I know my reply is a little late, but I am new to this website as a contributer.
Which Shopware Version?
Are u using the responsive theme?
Please provide a little more information. :)
I am trying to create a Joomla site that would be showing the article order numbers (not Article ID) inside each article. that way I can handle it like a book.
Each page will show the article order number at the corner - like a page.
That way I will be able to have the site modeled by categories and pages will show with their page number (Article Order number) at the corner.
I want to give the user the ability to watch the pages like they are reading books by categories.
I would be happy to know - how can I add the article order number (for each category) inside the article itself.
I am sure that there is a PHP code that can do that.
Thanks so much for your help and assist.
Arye
You'll need to override the default article layout in your template.
If your template doesn't already have an article layout, you can copy the default layout from components/com_content/views/article/tmpl/default.php inside your template override templates\[YOURTEMPLATE]\html\com_content\article\default.php (replacing [YOURTEMPLATE] by your actual template name.
You can then display ordering where you require it within your template by using
<?php echo $this->item->ordering; ?>
You'll most likely want to either check for a certain condition (the article's category, perhaps) to determine whether you want to display the ordering.
Another option is to create an alternative layout instead of overriding the default one. You can rename default.php in your template to, let's say bookpage.php. You will then be able to pick the new layout as an alternative layout in your articles' options.
you can get article id by using
Request::getVar('id');
for more you can check the link
Joomla plugin : how to get article title and article id
for jquery you can do like this. you can create a function and call on every page load it will sort all your content accordingly. you can assign other attributes also in foreach loop.
<div id="allArticles">
<article id="3">Article 3</article>
<article id="1">Article 1</article>
<article id="2">Article 2</article>
</div>
$("#allArticles article").sort(function (a, b) {
return parseInt(a.id) > parseInt(b.id);
}).each(function(){
var elem = $(this);
elem.remove();
$(elem).appendTo("#allArticles");
});
more you can see the working example here http://jsfiddle.net/THMu3/
I have a developmental Magento Store I'm setting up with two languages. Everything works perfect except the SideBar Wishlist and the "My Account" Wishlist displays the Spanish option no matter what. Everything switches i.e. the "My Wishlist" title header, even the email to friend box that automatically writes in "Please, enter your comments..." changes correctly. But the product name and discription remians in Spanish. I've tried this suggestion here: Wishlist don´t capture store views lenguage
Has anyone figured out how to fix this or what I might have set incorrectly?
Thanks
I had this problem as well on Magento 1.6.2CE. - while switching store languages product names remain in default language.
On a file Wishlist\Model\Item.php arround line 319 you need to remove the line of code:
public function getProduct()
{
$product = $this->_getData('product'); // <-- remove this line
The $product object is reloaded again with the correct store filter.
I don't really understand the scenario, but based on your title I had came up with this.
By any chance, did you manually code the text on a HTML block?
I have came across with this problem, and what I did is find the code snippets where the text is being called. There I changed it with the code below, instead of directly using the text itself. Hope that it makes sense.
<?php $this->__('Customers'); ?>
if getChildHtml('product_type_data') ?> maps directly to catalog/product/view/type/simple.phtml by default, how do I map to my own file? If I wanted to create a file that would produce a small image to place on the product page, right under "availability" how would I tell magento to map to where I have put the file? From what I understand getChildHtml('product_type_data') ?> defaults to the file path: catalog/product/view/type/simple.phtml so how can I customize the magento defaults and tell it to map to my custom files i've created?
Could I do something like getChildHtml('etc/etc/my-file.phtml') ?>
Essentially, what I am trying to do is add a small image under "availability" of my site (ex: http://climbhigh.com/climbing/climbing-ropes/petzl-dragonfly-rope-8-2mm.html) that says free shipping. Just trying to find the best way to do it.
I hope I have explained this well enough, if not, please let me know and I will try to explain more. Any help or guidance would be awesome. Thanks.
The code getChildHtml('product_type_data') doesn't always map directly to the template file catalog/product/view/type/simple.phtml. It only maps to that file if the layout handle PRODUCT_TYPE_simple is loaded, i.e. if the current product is a simple product. In order to change the template to be a different one you need to update the template attribute in the layout. At it's most simple this can be achieved by editing app/design/frontend/base/layout/catalog.xml and changing the template attribute.
<block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data" template="your/new/path.phtml">
Of course editing core files is a bad idea, so you should make a quick search for how to correctly add layout updates via either local.xml or customer layout update files.
I ended up figuring out what I needed to do. I simply wanted to add a small image to my product detail page that highlight a free shipping option. All I had to do was create a static block in the admin panel of magento and go into catalog>product>view.phtml file and insert:
getLayout()->createBlock('cms/block')->setBlockId('your_block_id')->toHtml(); ?>
it worked like a charm!
thanks for the help Crags
I am trying to inject content into the comment_template() similiar to how you can with comment_form().
For example:
<?php
$args = array("comment_notes_before" => myrp_api_ratings_form_table(null, true));
comment_form($args);
?>
This will make it so what is returned from the myrp_api_ratings_form_table function will appear before the comment form instead of after the submit button.
Is there any way to do something similiar but using the comment_template() function? I tried looking at the codex with no luck. Also, is there any good links to modifying the output of comment_template() any further?
Thank you
There is a lot of actions and filters that is available on the comment_template, you can use them to modify the template, or just build your own template. Here's a list of all the filters and actions available:
http://codex.wordpress.org/Plugin_API/Filter_Reference#Comment.2C_Trackback.2C_and_Ping_Filters
EDIT:
This thou only changes the data of each comment. If you want to change the display, and structure of the real template, I guess you have to create your own template. But it's not as hard as it sounds, there is a great guide in the codex with some nice examples: http://codex.wordpress.org/Function_Reference/wp_list_comments