I have seen some templates in Joomla that allow you to create a subtitle for an article just by entering the text into a single title text field such as this...
The Article Title | And My Subtitle
It doesn't seem to be a custom field - it appears more like it might be a shortcode. Has anybody come across this before and know where I can find the code for this or where in such templates I should look?
You would do this in a template override. Anywhere the title field might display, you would want to do something like this in the code before the title display part -
<?php
$titleparts = explode("|",$this->item->title);
$this->item->title = $titleparts[0];
$subtitle = $titleparts[1];
?>
You would probably want to put in a conditional statement looking for the | in the title before processing it, but you get the idea.
WARNING - I didn't test this code but it should work.
Related
I am starting up with Magento.
Trying to change color of content heading to red.
I have updated cms_page table like below using HTML tags:
It is being shown on page like below:
Color is not changed.Text is being shown as it is, with tags.
How can I set color for content heading?
Well, the tag isn't good.
If you want to style inline you should use something like:
<p style="color:red">New Content Heading</p>
Although i would strongly recommend to style via less files
Hope this helps you!
I'm trying to use markup tags to link to info pages within the "description" attribute of a product. However, it's not giving me a clean URL path when the description is printed to the page.
Trying:
Contact Us
does not give the expected url. I've confirmed i'm doing this outside of WYSIWYG mode too.
When the text is rendered is returned to the browser as this html:
Contact Us
A resulting click on the link then ends up as:
http://example.com/prod-category/my-product/%7B%7Bstore%20url=
From what I can tell the markup tags aren't designed to be used in this way. Is it possible to extend it so it could work? Otherwise I guess I need to include the actual URL in the description?
Thanks for suggestions.
You can´t use the double-curly syntax because the attributes value is not being processed by magento´s template filter, which does the magic. You can use them e.g. in CMS or email Templates out of the box.
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'); ?>
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...
I’m trying to display the menu title text (example “Home”) in the header area of my Joomla 2.5 website.
Joomla’s default (when activated) is to place it in the Component area.
I’m not sure the best way to accomplish this. By default Joomla wraps the menu title with an H1 tag but doesn’t wrap it with a div and class.
The ways I’ve thought might be best to do this are:
Somehow wrap all menu titles with a div and class so I could reposition them up into the header with css .
Add some php code to my template. Something like:
php
$menuTitle = $this->params->get(‘fieldNameOfMenuTitle’);
php
echo = $menuTitle;
Any ideas, suggestions, or answers would greatly appreciated
Thanks
Never found an exact answer but found a work around.
Used a modified version of the below demo/plug-in to create a custom field (named it: "Title that displays on the Web Page") in the articles menu. By default, the table that is created and displayed in the web page is in the component area and is wrapped in a w/ a class. Repositioned the with CSS up into the header/banner area.
http://docs.joomla.org/Adding_custom_fields_to_the_article_component