How to hide someparts in otherpage except home in codeigniter - php

I want to show a slider module on home page but hide it on rest of the site. Could anyone help me hide it. I am using HMVC in Codeigniter
<div class="col-xs-12 col-md-11 col-lg-11 navdiv" id="services_menu">
<?php
echo Modules::run('slider');
?>
</div>

You can try
<?php
if($this->router->fetch_class()=='home_controller_name'){
?>
<div class="col-xs-12 col-md-11 col-lg-11 navdiv" id="services_menu">
<?php
echo Modules::run('slider');
?>
</div>
<?php
}
?>

Create an seperate view for slider as slider.php. Put your following code into it
<div class="col-xs-12 col-md-11 col-lg-11 navdiv" id="services_menu">
<?php
echo Modules::run('slider');
?>
</div>
And while loading the Home page, Load this slider.php also like as follows :
$this->load->view("header.php");
$this->load->view("slider.php");
$this->load->view("home.php", $data);
$this->load->view("footer.php");
For other pages don't load the view slider.php.
Cheers!!

Related

How to get two href with a condition in a button with php?

On my page, I have a button that links to a form.
Right now, it s linked to the English version even when the page is in Spanish.
Is it possible to add a condition like, if the English version => link to the English version form and if it s the Spanish version link to the Spanish form?
On this button <?php _e("Let's Grow", "mywebsite"); ?>
The spanish link is /aplicar/
Thank you in advance!
<div class="banner bg-purple">
<div class="container">
<div class="row d-flex align-items-center m-h-400 bg-img-building-blocks">
<div class="col-6"></div>
<div class="col-6">
<h3><?php _e("we believe your potential", "mywebsite"); ?><br/><?php _e("is good business", "mywebsite"); ?>.</h3>
<?php _e("Let's Grow", "mywebsite"); ?>
</div>
</div>
</div>
</div>
you can use get_locale():
<?php $link = get_locale() == 'es_ES' ? 'aplicar' : 'apply'; ?>
<?php _e("Let's Grow", "ascendus"); ?>

System print by default else message in php

I write these code for searching functionality in my project.
If user enter correct zip code it show one form if zip code is wrong it show some message which i write in else condition.
But by default is show the else message when user enter first time on page.
I want to show that(message which i write in else condition) message if user enter wrong zip code what i do?Any suggestion.
<small>Enter your zipcode to book our service</small>
<?php if($this->isAllowedZipcode=="Matched"){?>
<div class="row">
</div>
<?php } ?>
<?php } else
{ ?>
<div class="row">
<div class="col-sm-12 col-xs-12">
<p>Sorry but our services are not available in your area. We are working hard to cover as much area as we can. Thank you for using the system.</p>
<?php } ?>
Your code seems to be incorrect/incomplete, but as per your requirements, you could do it as follow:
<small>Enter your zipcode to book our service</small>
<?php if($this->isAllowedZipcode=="Matched"){ ?>
<div class="row">
//ZIPCODE MATCHED
</div>
<?php } else { ?>
<div class="row">
<div class="col-sm-12 col-xs-12">
<p>Sorry but our services are not available in your area. We are working hard to cover as much area as we can. Thank you for using the system.</p>
</div>
</div>
<?php } ?>
You can use elseif condition when you can test if the zip code is set, not only else.
<small>Enter your zipcode to book our service</small>
<?php if($this->isAllowedZipcode=="Matched"){?>
<div class="row">
</div>
<?php } elseif (isset($inputZipCode))
{ ?>
<div class="row">
<div class="col-sm-12 col-xs-12">
<p>Sorry but our services are not available in your area. We are working hard to cover as much area as we can. Thank you for using the system.</p>
<?php } ?>

Hide a tab with no content on a Magento EE product page

I have successfully added a tab to my view.phtml page located at app/design/frontend/enterprise/aps/template/catalog/product.
I tried an if statement to hide it if the Specifications field is empty, i.e. no content. The issue is, it doesn't work. It still shows the tab even if there is no content.
My code is below at the end of post.
2 Questions:
Am I taking the correct approach? Basically, I am making a tab to have an Expert Review tab. I originally was going to use a cms block, but figured purposing the Specifications field was easier, for one, but also I could ignore the tab if no content
Can you please help ? :)
Thanks so much and here is my code and I attached a screenshot of the empty tabs.
<div class="wa-product-details-tab product-description">
<div class="wa-product-details-tab-heading product-desc-tab">
<div rel=".wa-product-tab-details-item-1" class="wa-product-heading-item wa-product-heading-item-1 wa-product-heading-item-active">
<span>Description</span>
</div>
<div rel=".wa-product-tab-details-item-2" class="wa-product-heading-item wa-product-heading-item-2">
<span>Specs</span>
</div>
<div rel=".wa-product-tab-details-item-3" id="review-form" class="wa-product-heading-item wa-product-heading-item-3">
<?php
$summaryData = Mage::getModel('review/review_summary')
->setStoreId(Mage::app()->getStore()->getId())
->load($_product->getId());
?>
<span >Reviews (<?php echo $summaryData->getReviewsCount();?>)</span>
</div>
<div rel=".wa-product-tab-details-item-4" class="wa-product-heading-item wa-product-heading-item-4">
<span>APS Advisor Review</span>
</div>
</div>
<div class="wa-product-tab-details product-desc">
<div style="display: block;" class="wa-product-tab-details-item wa-product-tab-details-item-1">
<?php echo $_product->getDescription(); ?>
</div>
<div style="display: none;" class="wa-product-tab-details-item wa-product-tab-details-item-2">
<p> <?php echo $this->getChildHtml('additional')?></p>
</div>
<div style="display: none;" class="wa-product-tab-details-item wa-product-tab-details-item-3">
<p>
<?php echo $this->getChildHtml('review_form') ?>
<?php echo $this->getChildHtml('product_additional_data_review') ?>
</p>
</div>
<div style="display: none;" class="wa-product-tab-details-item wa-product-tab-details-item-4">
<?php if ($_product->getSpecifications()); ?>
</div>
</div>
I am not sure if I understood your issue correctly. I am assuming that you want to hide the "APS Advisor Review" tab if there is no content in it.
For this you can use an if condition to check if $_product->getSpecifications() has any content, and show the tab title only if there is any content like this
<?php if( !empty($_product->getSpecifications()) ){ ?> <!-- displays the tab title only if the product has any specifications -->
<div rel=".wa-product-tab-details-item-4" class="wa-product-heading-item wa-product-heading-item-4">
<span>APS Advisor Review</span>
</div>
<php } ?>

Custom page template works fine on local host but doesn't show up online

I created a custom page template for a wordpress theme , as long as I had the theme installed locally page was displayed and showed within it the custom post type associated with it , but when I loaded online theme and I created the page by selecting the template to be used the page content doesn't show up.
It seems that by selecting the page template is not created the page with this template , but creates a page with the content of the index.
this is my page code with the loop that shows a custom_post_type
<?php
/*
*Template Name: Partecipanti
*Description : Pagina che raggiude tutte le associazioni partecipanti
*/
?>
<?php get_header(); ?>
<div id="partecipanti" class="content-container row">
<h2 class="titolo-pagina"><?php the_title(); ?></h2>
<?php
$wpquery = new WP_Query(array(
'post_type' => 'partecipanti',
'posts_per_page' => -1,
));
while ($wpquery->have_posts()): $wpquery->the_post();
?>
<div class="container-partecipante col-lg-3 col-md-3 col-sm-4 col-xs-12 visible-xs">
<?php the_post_thumbnail() ?>
<h2 class="nome"><?php the_title() ?></h2>
</div>
<div class="flip-container container-partecipante col-lg-3 col-md-3 col-sm-4 col-xs-12 hidden-xs" ontouchstart="this.classList.toggle('hover');">
<div class="flipper">
<div class="front">
<?php the_post_thumbnail() ?>
</div>
<div class="back">
<h2 class="nome"><?php the_title() ?></h2>
<a class="glyphicon glyphicon-plus" href="<?php the_permalink(); ?>"></a>
</div>
</div>
</div>
<?php endwhile; wp_reset_query(); ?>
Maybe you just forgot set Page Template in page's edit? Or it was bugged - try delete template, save page (to auto-remove page template), upload template, set it again and save.
Also check if page template is at all used - for example place plain HTML test before <div id="partecipanti" class="content-container row"> and check if is displayed.
Have you the same WordPress version and plugins installed? Maybe you missed changed setting?
Try with simple page template, for example default full-width - are editor content is displayed?
Or maybe you have the same bug like me with latest WP version - when page is child (have parent page), it's bugged and page template doesn't work + page is outputed as post instead page.
Check file permisions in your theme folder

How can I display this logo on all the pages except the home page?

I have this code PHP:
<?php if (!is_home()){ ?>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12 style="">
<img src="wp-content/themes/WordPressBootstrap-master/images/LOGOb.png" class="img-responsive center-block" style="min-width:156px;min-height:83px">
</div>
</div>
</div>
<?php } ?>
This is site:
http://avocat2.dac-proiect.ro/
I want this logo to be displayed on all pages of the home page less and unfortunately tried my code does not work.
Is something wrong?
What should be corrected so that it works?
How can i solve this problem?
Thanks in advance!
you might want to try:
!is_front_page()
or
!is_page('home')
use the latter if the slug for your homepage is 'home'
is_home() only works for the posts page, so unless your homepage is the blog, it won't produce results.

Categories