Implementing a simple lightbox in Joomla 4 - joomla

I am trying to transition to Joomla 4.
I have been using <?php JHTML::_('behavior.modal'); ?> in my index.php template.
Now I want to use <?php JHTML::_('bootstrap.renderModal', 'modal-' . $name, $params); ?>.
In the html of the articles, we used:
<a id="modal_info" class="modal" href="images/stories/hotel_suite1.jpg"><img style="width: 30%;" src="images/stories/hotel_suite1.jpg" alt="Null" /></a>
with various values for width and src. What do I change in my html? And I assume I need to add placeholders for $name and $params in my index.php. How do those get filled in realtime?

Related

Magento: how to display products on owl-carousel

I'm using magento 1.9.3 and I want to display featured products in home page in an owl carousel.
I have a method in the block of my module that returns me the collection I want to show in the carousel. I call it from my template like this:
$_productCollection=$this->getFeaturedProducts();
I found a previous question in stack overflow about this: Owl Carousel - Magento Products
and following this previous question I arrived to this in my template:
<div class="owl-carousel">
<?
$products = $this->getFeaturedProducts();
foreach ($products as $_product) { // iterate through the entire collection
echo '<div class="item"><img src='.$this->helper('catalog/image')->init($_product, 'small_image')->keepFrame(false)->resize($_imgSize).'></div>'; // print the image url inside of the required Owl markup
}
?>
</div>
But the div of owl-carousel is not displayed. If I inspect the page, the div is there, and the images inside too, but nothing is displayed. If I delete the owl-carousel class I see all the images displayed in list.
I installed the extension "Responsive Owl Slider" from magento connect, and I have another owl carousel on top of page made with the admin cms that shows image slides (not products) and it's working fine. The only one that fails is the one that I'm trying to do by code.
I see that the owl-carousel class has a display: none so obviously is not displaying anything, but if I delete the display: none it shows all the images at the same time, not a carousel.
How do I display my selected products in an owl carousel?
Please try this extension
https://www.magentocommerce.com/magento-connect/new-products-2.html
Hope it's helpful for you.
First go to the link >> https://magento.stackexchange.com/questions/83912/featured-products-on-homepage
Create all files to following answers.
Then open featured.phtml
copy and paste below code
<?php
$_helper = $this->helper('catalog/output');
$_productCollection = $this->getProductCollection();
?>
<div class="featured-products">
<ol class="featured-products-list owl-carousel" id="featured-products-list">
<?php foreach ($_productCollection as $_product): ?>
<li><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(200) ?>" alt="<?php echo $this->escapeHtml($_product->getName()) ?>" /></li>
<?php endforeach; ?>
</ol>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(".owl-carousel").owlCarousel();
});
</script>
Please don't forget create attribute and assign for products.

Joomla 3.36 - Browser Page title

Hi I go to menu page display and enter text into the Browser Page title field but
It does not change the browser page title.
Does anyone have any ideas what could create this issue?
I've had this situation occur most frequently with 3rd party components. Joomla stores these values when you specify them in the menu item, but it's up to the component whether or not they're used. Below is the code I've added to the template overrides. If you don't know how to override template output, you should read How to override the output from the Joomla! core first.
Put this code before any other HTML code in the template override file. It checks to see if you've specified to show the page headings or not, and if so, it will use that, otherwise it will use whatever the menu title is.
<?php if ($this->params->get('show_page_heading',1)) : ?>
<h1><?php echo $this->params->get('page_heading') ? $this->params->get('page_heading') : JFactory::getApplication()->getMenu()->getActive()->title; ?></h1>
<?php endif; ?>
To see how Joomla does it by default, look at components\com_content\views\article\tmpl\default.php
<div class="item-page<?php echo $this->pageclass_sfx?>">
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<div class="page-header">
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif;

magento: how to show custom attributes from general tab in front page automatically

when we upload one product, there is a default attribute set "Default", and in the general tab, there are many default attributes like below image:
well, i added one more custom attribute named "size", when i drag 'size' to general tab on the left, that mean the product has one more attribute. if i want to show the size attribute in the product view page of front end page, i have to put the code: "$_product->getAttributeText('size')", if i added lots of custom attributes, i have to put lots of codes manually. so, my question is how i can show all custom attributes automatically instead of adding one by one manually ?
This is allready done by magento.
Mark your attributes as vissible in frontend and thats it.
Have a look at the template attributes.phtml in path app/design/frontend/yourtheme/default/template/catalog/product/view
<?php if($_additional = $this->getAdditionalData()): ?>
<!--h2><?php echo $this->__('Additional Information') ?></h2-->
<div class="data-table accordion" id="product-attribute-specs-table">
<?php foreach ($_additional as $_data): ?>
<?php $_attribute = $_product->getResource()->getAttribute($_data['code']);
if (!is_null($_product->getData($_attribute->getAttributeCode())) && ((string)$_attribute->getFrontend()->getValue($_product) != '')) { ?>
<div class="clearer <?php echo $this->htmlEscape($this->__($_data['label'])) ?>">
<div class="trigger"><?php echo $this->htmlEscape($this->__($_data['label'])) ?></div>
<div class="triggerContent" style="display: none;"><span><?php echo $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></span></div>
</div>
<?php } ?>
</div>
<script type="text/javascript">decorateTable('product-attribute-specs-table')</script>
You need to copy the default file from /app/design/frontend/base/default/template/catalog/product/view to your theme directory
/public_html/app/design/frontend/default/yourtheme/template/catalog/product/view

Display pagination on both top and bottom K2 joomla

Pagination is working fine displaying on the bottom of the page.The issue is that I want to display pagination on both above & bottom of the page.
Help appreciated!!
You should be able to do this by adding in a template override. Copy the files in JOOMLA SITE/components/com_k2/templates into JOOMLA SITE/templates/YOUR TEMPLATE/html/com_k2. This means putting the pagination at the top will not be overriden in the event of a k2 update
Then just copy the pagination code to the top of the page.
e.g. for the category section (file default/category.php) you should find on line 252 (in version 2.6.1)
<!-- Pagination -->
<?php if(count($this->pagination->getPagesLinks())): ?>
<div class="k2Pagination">
<?php if($this->params->get('catPagination')) echo $this->pagination->getPagesLinks(); ?>
<div class="clr"></div>
<?php if($this->params->get('catPaginationResults')) echo $this->pagination->getPagesCounter(); ?>
</div>
<?php endif; ?>
Just by coping this code to the top of the page (circa line 131) you should get a second set of pagination!!

Carousel with dynamic content

I came across a carousel from Twitter bootstrap here. http://twitter.github.com/bootstrap/javascript.html#carousel
It looks really good. But all the images / content in the example are hard-coded. How can I request the server for new content and show it in the carousel?
The answer would have to be adjusted for each language, but assuming you're programing in PHP, it may look something like this:
If you have an array of images:
$images = ['path/to/image.jpg', 'path/to/image2.jpg', 'path/to/image3.jpg']
Then you'd loop through those images, and place each one in the appropriate HTML markup, like so:
<?php foreach ($images as $image) { ?>
<div class="item">
<img src="<?php echo $image ?>" />
</div>
<?php } ?>

Resources