Allow HTML input in Joomla Contact input fields - joomla

By default, Joomla seems to strip and remove any HTML content entered into the Contact details.
I want to add line breaks to the address textarea box. Now, I understand I need to add filter="raw" to the XML file, which would mean hacking the core. (from this article: http://docs.joomla.org/Textarea_form_field_type)
Is there anyway to do this via an override instead?

My idea :
Make an overide of this file : "components\com_contact\views\contact\tmpl\default_address.php"
Replace <?php echo $this->contact->address .'<br/>'; ?> by <?php echo str_ireplace('-br-' ,'<br />', $this->contact->address) .'<br/>'; ?>
When you provide an adress, write "-br-" for each break line.

Related

Processwire Add css class to page

I there a possibility to add a classname to a page?
I can't figure out how to implement such feature or if it already exists.
I'm using Processwire 3.0.42.
Put something like this in your template where the body is:
<body class="<?php echo $page->template->name; ?>">
That will give your page body tag a class equal to page template name.
You can add a page title in the same way.
<body class="<?php echo $page->name; ?>">
Don't be worried about adding a class to every page. The overhead of doing this is negligible.
If you wish to add a different class you would need to add a field to your template and append it to the code above.
As always in ProcessWire, everything is under your control. Alternatives to #ivangretsky's perfectly good answer would include-
Simply include a conditional in your template file. (This doesn't scale well if you need to add other classes to other pages using the same template.)
<?php
$bodyClass = '';
if($page->id == 1021) $bodyClass = 'my-class';
?>
<body class="<?php echo $bodyClass; ?>">
NB Using $page->id is better than $page->name, for example, as the ID doesn't change while the name could.
You could also add a field to the page template definition. Add a field called something like 'Body Class'. Then use the content of that field in your template file.
<body class="<?php echo $page->body-class; ?>">
This will scale better than my other suggestion, and there are options in the ProcessWire backend to hide or partially hide the field during normal use if you don't want users messing with its value.
One 'gotcha' from the CSS spec to be aware of is that CSS identifiers, including class names and IDs cannot start with a digit, so you cannot just use $page->id.
There are lot of options and it depends on your needs and maybe imagination :-).
You can use page name, template name, page id, or maybe combination.
<body class="<?php echo $page->template->name; ?> page-id-<?php echo $page->id; ?>">
// Output
<body class="your-template-name page-id-1234">
This way you can target template, page, or both.
Or, as mentioned by #ivangretsky, you can add custom field to page. And again, you can combine this aproach with template name, etc.
It depends on your needs and what you want to achieve.
Notice:
Using $page->id is better than $page->name, as the ID doesn't change while the name could. #DaveP

remove date from the reviews (comments) section in magento

I want to know how I can remove date from the reviews (comments) section in magento. I have tried removing the date code many time from the back-end, but still it is showing the date.
The elements you want to hide are of class .review-meta
If you're happy just to hide them rather than remove the code completely, simply add the following style to your css:
.review-meta{
display:none;
}
Alternatively, if you wish to completely remove the relevant code then copy the folder from app/design/frontend/base/default/template/review into your custom layout directory (eg. app/design/frontend/rwd/my_custom_layout/template), and then within the copy edit the file review/product/list.phtml as follows:
Remove the following code:
<span class="review-meta">
<?php echo $this->__('Review by %s', $this->escapeHtml($_review->getNickname())) ?>
/
<?php echo $this->__('(Posted on %s)',$this->formatDate($_review->getCreatedAt()), 'long') ?>
</span>

Linebreak in magento product description when NOT using wysiwyg

I have a Magento webshop with over 17.000 products. Products and their description are imported from CSV files. The descriptions have linebreaks in them - but these are not translated to the frontend view due to the fact the Wysiwyg editor isn't used.
I have found tons of ways to remove extra linebreaks when the wysiwyg editor is used, but none that would help me to add linebreaks when the text editor is used.
Is it possible to automatically add these linebreaks or paragraphs to the content in the normal / standard text editor automatically? And if so, how do I best proceed?
It may be that your theme overrides the default behaviour in Magento with regard to applying line breaks via php. In the file;
app\design\frontend\base\default\template\catalog\product\view\description.html
You'll see it outputs the description like;
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
It may be that the easiest thing to do is use the same technique used with the short description in the base package and apply the php function nl2br to it to get your imported line breaks;
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), nl2br($_description), 'description') ?>

Changing the position of Joomla 3.2 tags

I have added some tags and linked these to an article. On the front end the tags appear on top (i.e. before) the article text. Instead I would like to display them at the bottom (i.e. after) the article.
I assume I have to make an override of layouts/joomla/content/tags.php
Create a Template Override for the following file:
components/com_content/views/tmpl/default.php
Once done, open this file in your override location and go to line 157 and you will see the following:
<?php if ($params->get('show_tags', 1) && !empty($this->item->tags)) : ?>
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
<?php endif; ?>
Move this section of code somewhere futher down in the file to suit your needs
Hope this helps
This can be easily achieved by simply changing the Position Of Article Info to "Below" in Options Tab in Joomla Menu. The Joomla menu has to be of Type "Article"
No need to create any override.
Hope this helps.
See attached screenshot.

Joomla Registration form Fields Ordering

How do I order the fields on my joomla registration form?
As you can see, the captcha must be at the bottom:
http://www.celinasoft.com/index.php/component/users/?view=registration
First of all you will need to create your Registration view template override (to keep it Joomla update proof). To do so, create folder /templates/YOUT_TEMPLATE/html/com_users/registration and copy /components/com_users/views/registration/tmpl/default.php file there.
Then you will need to modify the code itself, open /templates/YOUT_TEMPLATE/html/com_users/registration/default.php file, you will see, that by default Joomla takes ALL fields from registration.xml file and just loops them through foreach cycle, this code:
<?php foreach ($this->form->getFieldsets() as $fieldset): ?>
...
...
<?php endforeach; ?>
You need to replace this cycle by your manual fields output like this:
<div class="control-group">
<div class="control-label"><?php echo $this->form->getLabel('email'); ?></div>
<div class="controls"><?php echo $this->form->getInput('email'); ?></div>
</div>
...
...
And output all desired registration fields like that, in order you prefer. Warning: don't forget that almost all of that fields are required for registration and cannot be missed.
You can find all field names in XML file components/com_users/models/forms/registration.xml
Please note that this is only sample code, to understand the logics. It haven't been tested live. So if errors occur - please let me know and we'll fix it :)
If anyone have a better/easier solution - I'd be happy to hear it.

Resources