what is the code for featuring data in joomla? - joomla

The following code will show in all pages,
but I want to hide it in main page, how can I feature this?
My code
<div class="container-fluid bginner">
<div class="container">
<div class="row">
<div class="slider-inner col-lg-3 col-xs-12 hidden-sm col-md-3">
<jdoc:include type="modules" name="inner-sidebar" style="sidebar" />
</div>
<div class="<?php echo $main; ?>">
<jdoc:include type="component"/>
</div>
</div>
</div>
</div>
<?php
$left = $this->countModules('inner-sidebar');
if ($left > 0)
$main = "col-lg-9 col-xs-12 col-md-9 main-content";
else
$main = "col-lg-12 col-xs-12 main-content";
?>

There are some solutions
Joomla doc

Related

Laravel Blade foreach combine

I have two separate divs, one where the images are loaded and the other where the data is displayed.
<div class="banner-slider-image">
<div class="swiper-container">
<div class="swiper-wrapper">
<!-- Slide Item -->
<div class="swiper-slide">
<div class="bg" style="background-image: url(include/assets/images/main-slider/1.jpg);">
</div>
</div>
</div>
</div>
</div>
<div class="banner-slider-content">
<div class="side-text">AVANT</div>
<div class="swiper-container banner-slider">
<div class="swiper-wrapper">
#if(count($listings) > 0)
#foreach($listings as $listing)
<!-- Slide Item -->
<div class="swiper-slide">
<div class="content-outer">
<div class="content-box">
<div class="inner">
<h5>{{$listing->first_name}} {{$listing->last_name}}</h5>
<h1><span>{{$listing->name}}</span> </h1>
<div class="text">{{$listing->property_description}}.</div>
<div class="link-box">View Listing</div>
</div>
</div>
</div>
</div>
#endforeach
#endif
</div>
</div>
</div>
So the first div will also be in a foreach loop, but I dont know how I can combine the two where they show the same related data.
Use 2 foreach loops . It is the easiest and desired solution for you. or you can define two variable and concat the contents using one forloop and then display them later like
#php
$first='';
$second='';
#endphp
#if(count($listings) > 0)
#foreach($listings as $listing)
#php
$first.='first div content';
$second.='second div content';
#endphp
#endforeach
#endif
<div class="banner-slider-image">
<div class="swiper-container">
<div class="swiper-wrapper">
{!!$first!!}
</div>
</div>
</div>
<div class="banner-slider-content">
<div class="side-text">AVANT</div>
<div class="swiper-container banner-slider">
<div class="swiper-wrapper">
{!!$second!!}
</div>
</div>
</div>
<html>
<body>
#section('sidebar')
This is the master sidebar.
#show
<div class="container">
#yield('content')
</div>
</body>
use for yield

Dynamic Carousel In Laravel not displaying proper data

<div class="container mt-4 mb-4">
<div class="row">
<div class="col-lg-12">
<div id="blogCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
#foreach($reviews as $items)
<div class="carousel-item #if($loop->first) active #endif">
<div class="row">
#foreach($reviews as $review)
<div class="col-lg-4 ">
<a>
<div class="home1-img mt-3">
<?php
for($i=1;$i<6;$i++){
$check = '';
if($review->number_of_stars >= $i){
$check = 'checked';
}
echo '<span class="fa fa-star '.$check.'"></span>';
}
?>
<div class="home1-text mt-1" style="margin-bottom:30px;">
<p>{!! Illuminate\Support\Str::limit($review->customer_review,100) !!}</p>
<h5 class="text-color font-weight-bold">{{ $review->customer_name }}</h5>
</div>
</div>
</a>
</div>
#endforeach
</div>
</div>
#endforeach
</div>
</div>
</div>
</div>
</div>
I am getting all the records in all sides but I want 3 records in 1st slide then 3 records in 2nd slide and so on. I have tried many times but I am not able to fix it.

why does $this->form_validation->run() always return false in codeigniter 3.0.0 with php7.1 on ubuntu 16.04?

This is part of the code, it made me cannot login, i don't know where is the problem. When i tried to log in, it has no effect. Sorry for my bad english.
public function login()
{
if ($this->identity->is_admin())
redirect('admin/dashboard');
if ($this->identity->is_contestant())
redirect('contestant/dashboard');
$this->form_validation->set_rules('form[username]', $this->lang->line('username'), 'trim|required|max_length[50]');
$this->form_validation->set_rules('form[password]', $this->lang->line('password'), 'trim|required|max_length[50]');
if ($this->form_validation->run())
{
$credentials = $this->input->post('form');
if ($this->identity->login($credentials))
{
if ($this->identity->is_admin())
redirect('admin/dashboard');
else
redirect('contestant/dashboard');
}
else
{
$this->session->set_flashdata('error', $this->lang->line('wrong_credentials'));
redirect('site/login');
}
}
else
{
$this->ui['header']['title'] = $this->lang->line('login');
$this->ui['header']['page'] = 'login';
$this->load->view('site/header', $this->ui['header']);
$this->load->view('site/login', $this->ui['content']);
$this->load->view('footer', $this->ui['footer']);
}
}
Here are the login site source code.
<div class="container">
<div class="row">
<div class="col-md-12">
<ul class="breadcrumb">
<li>
<i class="glyphicon glyphicon-off"></i> <?php echo $this->lang->line('please_login'); ?>
</li>
</ul>
</div>
</div>
<?php if ($this->session->flashdata('error')) : ?>
<div class="row">
<div class="col-md-5">
<div class="alert alert-danger">
<?php echo $this->session->flashdata('error'); ?>
</div>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col-md-12">
<form class="form-horizontal" action="" method="post">
<div class="form-group<?php echo form_error('form[username]') ? ' has-error' : ''; ?>">
<label class="col-sm-1 control-label"><?php echo $this->lang->line('username'); ?>:</label>
<div class="col-sm-4">
<input name="form[username]" type="text" maxlength="30" class="form-control" value="<?php echo set_value('form[username]'); ?>" autofocus="on"/>
<span class="help-block"><?php echo form_error('form[username]'); ?></span>
</div>
</div>
<div class="form-group<?php echo form_error('form[password]') ? ' has-error' : ''; ?>">
<label class="col-sm-1 control-label"><?php echo $this->lang->line('password'); ?>:</label>
<div class="col-sm-4">
<input name="form[password]" type="password" maxlength="30" class="form-control"/>
<span class="help-block"><?php echo form_error('form[password]'); ?></span>
</div>
</div>
<div class="form-actions col-sm-offset-1">
<button type="submit" class="btn btn-danger col-sm-3"><i class="glyphicon glyphicon-user"></i> <?php echo $this->lang->line('login'); ?></button>
</div>
</form>
</div>
</div>
is it true that php7.1 is not supported by CI 3.0.0 so the error happened by this?

i want to add bootsnipp slider in codeigniter

Here is my main view page :
the first class: item active ,
and another is only class: item
but i want foreach only class="col-sm-6" with two class item active and item ...
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-sm-6">
<div class="col-item">
<div class="photo">
<img src="img/a.jpg" />
</div>
<div class="info">
<div class="row">
<div class="price col-md-6">
<h5>title</h5>
<h5 class="price-text-color">
Contact for price</h5>
</div>
<div class="rating hidden-sm col-md-6">
<i class="fa fa-bed"></i> <b>3</b>
<i class="fa fa-bath"></i> <b>2</b>
</div>
</div>
<div class="separator clear-left">
<p class="btn-details">
<i class="fa fa-list"></i>More details</p>
</div>
<div class="clearfix">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-sm-6">
<div class="col-item">
<div class="photo">
<img src="2.jpg" />
</div>
<div class="info">
<div class="row">
<div class="price col-md-6">
<h5>title</h5>
<h5 class="price-text-color">
Contact for price</h5>
</div>
<div class="rating hidden-sm col-md-6">
<i class="fa fa-bed"></i> <b>5</b>
<i class="fa fa-bath"></i> <b>3</b>
</div>
</div>
<div class="separator clear-left">
<p class="btn-details">
<i class="fa fa-list"></i>More details</p>
</div>
<div class="clearfix">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
but when i foreach the div one is active class but i want one div is active but another is not . actually i want to foreach col-sm-6 class.. how to do this. first
I assume that you want the following:
for there to be one active item
for each item to contain several col-sm-6 elements, created via a php foreach loop
create item via a php foreach loop
<!-- language: lang-php -->
<?php $active_item = "active" ?>
<?php foreach($itemlist as $item): ?>
<div class="item <?php echo $active_item ?>">
<?php $active_item = "" ?>
<div class="row">
<?php foreach($item as $column): ?>
<div class="col-sm-6">
<!-- insert your logic here for creating your columns in a carousel -->
</div>
<?php endforeach ?>
</div>
</div>
<?php endforeach ?>
$active will append the active class to only the first instance of your carousel items.
I avoided using foreach($array as $key=>$value) and checking the key for whether the item is to be active, as your array may not have numerical keys that begin with 0.

Multiple textboxes validation in codeigniter 3

I have 4 textboxes which take url as input.
If user skips all, an error will be thrown to fill at least one input.
Also validate the user input, like if it is a valid url.
How to achieve this Codeigniter 3.x?
You have to use input type = "url", and put validations (add validate.js file for this) like below:
you can get validation.js from here: Validation.js
<!DOCTYPE html>
<html lang="en">
<head>
<title>Add User</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script>
</head>
<body class="backgroundfff">
<section>
<div class="padding0 main_padding" id="main_container">
<div class="container-fluid padding0 bg-clr">
<div class="container backgroundfff user-porfile-padding">
<div class="col-lg-12 col-md-12 col-sm-9 col-xs-12 margintop20px marginbottom45px">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 padding0"></div>
<div class="cp-box col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php
$add_form =
array(
'name' => 'advertiser-form',
"id" => "validateForm",
'method' => 'post',
'class' => "form-horizontal",
'role' =>'form'
);
echo form_open_multipart(DOMAIN_URL."users/adduser",$add_form);
?>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cyp-sub-title margintop20px">
<input type="url" placeholder="Textbox 1" name="Textbox1" id="Textbox1" class="">
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cyp-sub-title margintop20px">
<input type="url" placeholder="Textbox 2" name="Textbox2" id="Textbox2" class="">
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cyp-sub-title margintop20px">
<input type="url" placeholder="Textbox 3" name="Textbox3" id="Textbox3" class="">
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 cyp-sub-title margintop20px">
<input type="url" placeholder="Textbox 4" name="Textbox4" id="Textbox4" class="">
</div>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 padding0 margintop20px marginbottom20px text-center">
<button type="submit" class="cp-submit">Submit</button>
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
<script src="<?=DOMAIN_URL?>/js/validate.js" type="text/javascript" charset="utf-8"></script>
</html>
Server side validation:
<?php
function adduser($postData)
{
if(empty($postData['Textbox1']) || empty($postData['Textbox2']) || empty($postData['Textbox3']) || empty($postData['Textbox4'])) {
// redirect user to add form
}
}
?>
You can use FILTER_SANITIZE_URL to check the url is valid or not, like below:
filter_var($posted_url, FILTER_SANITIZE_URL);

Resources