Base url in background image joomla - joomla

I am creating a template and someone has created the orignal slider using
<div class="item active" style="background-image: url(../images/slider/bg1.jpg)">
My question is I am using Joomla to create this template how do i echo in the above html so that I can output the full url of site for at min its not finding the image.
<?php echo $this->baseurl ?>/

You can use
JUri::base()
accepting an optional parameter (true or false)
to include the protocol and site name.

Related

In voyager admin panel how to solve directory separator issue

I have created a page in the voyager admin panel, but when I tried to retrieve in view the path of the image is like
http://localhost:8000/storage/pages\October2019\eltiRUSN1BArKdXi4uyl.png
you noticed that the first forward slash and then next backward slash, so that's why an image is not displaying in view.
I used this code to print an image.
<div class="header_bg" style="background-image: url('{{ url("storage/$page_data->image") }}');"></div>
Instead of creating a url with url(), maybe you could use Laravel File Storage helpers, like Storage::get('file.jpg');. I believe these work in blade, so in your case, it would be:
<div class="header_bg" style="background-image: url('{{ Storage::get($page_data->image) }}');"></div>
The answer is, this image is set by voyage admin so I have use voyager language.
<div class="header_bg" style="background-image: url('{{Voyager::image($page_data->image)}}');"></div>
to the print image which set from voyager in blade view use this syntax
{{Voyager::image($page_data->image)}}

Magento: how to remove paragraphs around Widgets

I'm new to magento and I just put a widget in a cms page. After having a look at the source code I saw a surrounding p-tag around the widget. Is there a way to remove it without disabling the wysiwyg editor?
Turn on template hints in admin.
Assuming this is the template that the widget renders:
app\design\frontend\base\default\template\cms\widget\static_block\default.phtml
Copy this template to:
app\design\frontend\base\default\template\cms\widget\static_block\default.phtml
Replace the code from:
<div class="widget widget-static-block"><?php echo $this->getText(); ?></div>
to:
<div class="widget widget-static-block"><?php echo strip_tags( $this->getText() ); ?></div>
You can customize allowed html tags by including a second parameter:
https://php.net/strip_tags

magento - images not showing

I added a custom field for all cms pages and enabled text editor and i display the value in a phtml file.
This is working fine,but the images not showing properly,it is not evaluated,it display like as below,
<img style="float: left;" title="Incorrect method of de-coiling " src="{{media url=" wysiwyg="" faqs="" 2-incorrect-method.jpg"}}"="" alt="Incorrect method of de-coiling " width="230">
I display this content via the following code
<?php echo nl2br($post['post_content']); // display content ?>
Please help me to evaluate this content properly,I am new in magento
When adding images using wysiwyg editor button they will be relative to root/media/wysiwyg directory
img src="{{media url="wysiwyg/myfile.jpeg"}}"/>

Show intro-image and extra fields in Smart Search results in Joomla

I´m using Joomla Smart Search in my website and I´m want to show intro-image and some extrafields from the article in the search results.
Joomla Smart Search removes any html tags and I want to prevent to do this extra fields
in www\plugins\finder\content open content.php
then search for getListQuery , at the end of ->select list add ->select('a.images AS image'); save & close the file
in www\components\com_finder\views\search\tmpl open default_result.php
then search for class="result-title after the tag add these lines:
<?php $image=json_decode($this->result->image); ?>
<?php $aimage=$image->image_intro; ?>
<div class="search-img">
<a href="<?php echo JRoute::_($route); ?>">
<img src="/<?php echo $aimage; ?>" >
</a>
</div>
save & close
dont forget to purge & reindex the smart search
Smart search plugins say which fields should be indexed. You could replace some of the smart search plugins with ones of your own.
I have found a solution, not absolutly like I wanted but it works. The solution shows the intro-text and all inside the "read more" of the article in the search results (images, links and everything you want).
This solution was found here http://forum.joomla.org/viewtopic.php?p=2324152 and says something like this:
"You'll need to create a layout override for the components/com_finder/views/search /tmpl/default_result.php layout file using the steps described at http://docs.joomla.org/Understanding_Output_Overrides Once you've created the layout override, you should change"
<?php echo JHtml::_('string.truncate', $this->result->description, $this->params->get('description_length', 255)); ?>
in the layout file to:
<?php echo $this->result->summary; ?>
The location should be templates/template_name/html/com_finder/search/default_result.php
actually there is a very easy solution.
K2 saves the images based on the md5 hash of the id.
adding this:
<div class="search-img">
<img src="<?php echo JURI::base().'media/k2/items/cache/'.md5("Image".$this->result->id).'_M.jpg'; ?>" />
</div>
to the html override of the default_result.php will display the according k2 items (here in medium resolution)

Joomla show subcategory image on category page?

Is there a way, beside creating yet another MYSQL connection, to retrieve subcategory image while browsing parent category page?
For example:
Main category (set as category as blog)
Subcategory 1 (image set in Basic options image field)
Subcategory 2 (image set in Basic options image field)
Subcategory 3 (image set in Basic options image field)
....
Now, when i browse 'Main category', it display categories title and description of subcategories, but I cant find any 'normal' way to retrieve image that i set in basic option.
The only way that I can make to work is to create another MYSQL call and retrieve image from database, but I would like to know if there is another more effective way.
Im using Joomla 2.5.
Thanks!
I suggest you override the output of the content so that you can add some code to output your images.
Copy:
joomla/components/com_content/views/category/tmpl/blog_children.php
To:
joomla/templates/yourtemplate/html/com_content/category/blog_children.php
Then edit your new override file, just below:
<span class="item-title"><a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($child->id));?>">
<?php echo $this->escape($child->title); ?></a>
</span>
Add:
<div class="item-image">
<?php echo '<img src="'.json_decode($child->params)->image . '" />'; ?>
</div>
See Joomla docs for Component Output Types and Layout Overrides.

Resources