Yii2 Display Recently Added Members - php

I have a "Latest Staff Members" panel where it should display my recently added users. All I have is a static display of these users:
<div class="box box-danger <?= !User::isBizAdmin() ? 'hidden' : '' ?>">
<div class="box-header with-border">
<h3 class="box-title">Latest Staff Members</h3>
<div class="box-tools pull-right">
<span class="label label-danger">8 New Members</span>
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
<button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
</div>
</div><!-- /.box-header -->
<div class="box-body no-padding">
<ul class="users-list clearfix">
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/frank_man-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Alexander Pierce</a>
<span class="users-list-date">Today</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/Ben_man-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Norman</a>
<span class="users-list-date">Yesterday</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/iri_girl_face-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Jane</a>
<span class="users-list-date">12 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/Jay_man-128.png" alt="User Image"/>
<a class="users-list-name" href="#">John</a>
<span class="users-list-date">12 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/Fred_man-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Alexander</a>
<span class="users-list-date">13 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/michela_face_young-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Sarah</a>
<span class="users-list-date">14 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/carla_girl-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Nora</a>
<span class="users-list-date">15 Jan</span>
</li>
<li>
<img src="https://cdn2.iconfinder.com/data/icons/avatar-2/512/hena_woman_face-128.png" alt="User Image"/>
<a class="users-list-name" href="#">Nadia</a>
<span class="users-list-date">15 Jan</span>
</li>
</ul><!-- /.users-list -->
</div><!-- /.box-body -->
<div class="box-footer text-center">
View All Users
</div><!-- /.box-footer -->
</div>
Something like that. Now, in the user table in my database, I added a date_added column and I manually put dates in row.
Do I loop the data? Or use a widget? I don't know how else I should implement this.
EDIT
My controller:
public function actionIndex()
{
if(Yii::$app->user->isGuest){
return $this->render('../site/index');
}
else{
$latestStaffMembers = User::find()->orderBy(['date_added' => SORT_DESC])->limit(8);
return $this->render('dashboard', [
'latestStaffMembers' => $latestStaffMembers,
]);
}
}
In my view:
<?php foreach ($latestStaffMembers as $user) { ?>
<li>
<img src="<?php echo $user->avatar; ?>" alt="User Image"/>
<?= $user->username ?>
<span ><?= $user->date_added ?></span>
</li>
<?php } ?>
Then I get this error:
Trying to get property of non-object
I tried var-dumping $user and it says null.

I'm not sure if this is what you want. I hope it helps somehow.
In your controller action:
$latestStaffMembers = User::find()->orderBy(['date_added' => SORT_DESC])->limit(8)->all();
return $this->render('some-view-file', [
'latestStaffMembers' => $latestStaffMembers,
]);
In your view:
<?php foreach ($latestStaffMembers as $user) { ?>
<li>
<img src="<?= $user->imagePath ?>" alt="User Image"/>
<a class="users-list-name" href="#"><?= $user->name ?></a>
<span class="users-list-date"><?= Yii::$app->formatter->asDate($user->dateAdded, 'd m'); ?></span>
</li>
<?php } ?>
Btw: I saw !User::isBizAdmin() in your code. Is it yours? I would not just hide the list if it is important that only admins may see that. Just don't print it if user is not admin.

Related

Bootstrap 4 Carosuel with ACF Repeater field

Given this HTML code, how can I create a dynamic Carosuel with thumbnails using Bootstrap 4 that can be updated in back-end using ACF Repeater?
My Repeater field is called carousel_repeater and inside I have an Image field called carosuel_image
HTML code
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="custCarousel" class="carousel slide" data-ride="carousel" align="center">
<!-- slides -->
<div class="carousel-inner">
<div class="carousel-item active"> <img src="https://i.imgur.com/weXVL8M.jpg" alt="Hills"> </div>
<div class="carousel-item"> <img src="https://i.imgur.com/Rpxx6wU.jpg" alt="Hills"> </div>
<div class="carousel-item"> <img src="https://i.imgur.com/83fandJ.jpg" alt="Hills"> </div>
<div class="carousel-item"> <img src="https://i.imgur.com/JiQ9Ppv.jpg" alt="Hills"> </div>
</div> <!-- Left right --> <a class="carousel-control-prev" href="#custCarousel" data-slide="prev"> <span class="carousel-control-prev-icon"></span> </a> <a class="carousel-control-next" href="#custCarousel" data-slide="next"> <span class="carousel-control-next-icon"></span> </a> <!-- Thumbnails -->
<ol class="carousel-indicators list-inline">
<li class="list-inline-item active"> <a id="carousel-selector-0" class="selected" data-slide-to="0" data-target="#custCarousel"> <img src="https://i.imgur.com/weXVL8M.jpg" class="img-fluid"> </a> </li>
<li class="list-inline-item"> <a id="carousel-selector-1" data-slide-to="1" data-target="#custCarousel"> <img src="https://i.imgur.com/Rpxx6wU.jpg" class="img-fluid"> </a> </li>
<li class="list-inline-item"> <a id="carousel-selector-2" data-slide-to="2" data-target="#custCarousel"> <img src="https://i.imgur.com/83fandJ.jpg" class="img-fluid"> </a> </li>
<li class="list-inline-item"> <a id="carousel-selector-2" data-slide-to="3" data-target="#custCarousel"> <img src="https://i.imgur.com/JiQ9Ppv.jpg" class="img-fluid"> </a> </li>
</ol>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="custCarousel" class="carousel slide" data-ride="carousel" align="center">
<div class="carousel-inner">
<?php
if( have_rows('carousel_repeater') ):
// Loop through rows.
while( have_rows('carousel_repeater') ) : the_row();
$sub_value = get_sub_field('sub_field');// whatever ur image field is called
?>
<div class="carousel-item active"> <img src="<?php echo $sub_value['url'] ?>g" alt="Hills"> </div>
<?php
// End loop.
endwhile;
?>
<ol class="carousel-indicators list-inline">
<li class="list-inline-item active"> <a id="carousel-selector-0" class="selected" data-slide-to="0" data-target="#custCarousel"> <img src="https://i.imgur.com/weXVL8M.jpg" class="img-fluid"> </a> </li>
<li class="list-inline-item"> <a id="carousel-selector-1" data-slide-to="1" data-target="#custCarousel"> <img src="https://i.imgur.com/Rpxx6wU.jpg" class="img-fluid"> </a> </li>
<li class="list-inline-item"> <a id="carousel-selector-2" data-slide-to="2" data-target="#custCarousel"> <img src="https://i.imgur.com/83fandJ.jpg" class="img-fluid"> </a> </li>
<li class="list-inline-item"> <a id="carousel-selector-2" data-slide-to="3" data-target="#custCarousel"> <img src="https://i.imgur.com/JiQ9Ppv.jpg" class="img-fluid"> </a> </li>
</ol>
</div>
</div>
</div>
</div>
<?php
endif;
?>
Probs something like this, your gna need to play with it as i havent tested it but this is a start, would recommend you look into the documentation for ACF repeaters
https://www.advancedcustomfields.com/resources/repeater/

Select database with laravel 5.5

I am trying to query the database and get user information.
I use the adminlte System but when I run the view it returns a variable error.
HomeController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* #return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
$users = DB::select('select * from users');
return view('vendor.adminlte.page', ['users' => $users]);
}
}
Page.blade.php
#extends('adminlte::master')
#section('adminlte_css')
<link rel="stylesheet"
href="{{ asset('vendor/adminlte/dist/css/skins/skin-' . config('adminlte.skin', 'blue') . '.min.css')}} ">
#stack('css')
#yield('css')
#stop
#section('body_class', 'skin-' . config('adminlte.skin', 'blue') . ' sidebar-mini ' . (config('adminlte.layout') ? [
'boxed' => 'layout-boxed',
'fixed' => 'fixed',
'top-nav' => 'layout-top-nav'
][config('adminlte.layout')] : '') . (config('adminlte.collapse_sidebar') ? ' sidebar-collapse ' : ''))
#section('body')
<div class="wrapper">
<div class="wrapper" style="height: auto; min-height: 100%;">
<header class="main-header">
<!-- Logo -->
<a href="/home" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>U</b></span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>UNIDAS</b></span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Messages: style can be found in dropdown.less-->
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você tem 4 mensagens</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Informática
<small><i class="fa fa-clock-o"></i> 5 minutos</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<!-- end message -->
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Financeiro
<small><i class="fa fa-clock-o"></i> 2 horas</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Contabilidade
<small><i class="fa fa-clock-o"></i> Hoje</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Institucional
<small><i class="fa fa-clock-o"></i> Ontem</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Gerência
<small><i class="fa fa-clock-o"></i> 2 Dias</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
</ul>
</li>
<li class="footer">Ler todas Mensagens</li>
</ul>
</li>
<!-- Notifications: style can be found in dropdown.less -->
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você tem 10 notificações</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i>Não Imprimir Colorido
</a>
</li>
<li>
<a href="#">
<i class="fa fa-warning text-yellow"></i>Nova Reunião Redir
</a>
</li>
<li>
<a href="#">
<i class="fa fa-users text-red"></i>Aviso Copa
</a>
</li>
<li>
<a href="#">
<i class="fa fa-shopping-cart text-green"></i>Data Congresso Internacional
</a>
</li>
<li>
<a href="#">
<i class="fa fa-user text-red"></i> Banco de Horas
</a>
</li>
</ul>
</li>
<li class="footer">Ver todas Notificações</li>
</ul>
</li>
<!-- Tasks: style can be found in dropdown.less -->
<li class="dropdown tasks-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você tem 9 tarefas</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- Task item -->
<a href="#">
<h3>
Desenvolver Intranet
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Desenvolver novo layout
<small class="pull-right">40%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">40% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Desenvolver novo Administrador
<small class="pull-right">60%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">60% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Unificar superitêndencias
<small class="pull-right">80%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">80% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li class="footer">
Ver todas Tarefas
</li>
</ul>
</li>
<!-- User Account: style can be found in dropdown.less -->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="images/usuarios/richardnicson.jpg" class="user-image" alt="User Image">
<span class="hidden-xs">Richard Nicson</span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
<p>
Richard Nicson Costa de Lima - Desenvolvedor Web
<small>Membro desde Agosto. 2018</small>
</p>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
Perfil
</div>
<div class="pull-right">
<a href="#" class="btn btn-default btn-flat" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
<i class="fa fa-fw fa-power-off"></i> Sair
</a>
<form id="logout-form" action="http://intranet.unidas.org.br/logout" method="POST" style="display: none;">
<input type="hidden" name="_token" value="jmubQRfJenzcLKmbpvyjeMCVeafWedS5IPC36tmk">
</form>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
#if(config('adminlte.layout') != 'top-nav')
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p>Richard Nicson</p>
<i class="fa fa-circle text-success"></i> Online
</div>
</div>
<!-- search form -->
<form action="#" method="get" class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Pesquisar...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
</button>
</span>
</div>
</form>
<!-- /.search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu tree" data-widget="tree">
#each('adminlte::partials.menu-item', $adminlte->menu(), 'item')
</ul>
</section>
<!-- /.sidebar -->
</aside>
#endif
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" style="min-height: 1265px;">
#if(config('adminlte.layout') == 'top-nav')
<div class="container">
#endif
<!-- Content Header (Page header) -->
<section class="content-header">
#yield('content_header')
</section>
<!-- Main content -->
<section class="content">
#yield('content')
</section>
<!-- /.content -->
#if(config('adminlte.layout') == 'top-nav')
</div>
<!-- /.container -->
#endif
</div>
<!-- /.content-wrapper -->
</div>
<!-- ./wrapper -->
#stop
#section('adminlte_js')
<script src="{{ asset('vendor/adminlte/dist/js/adminlte.min.js') }}"></script>
#stack('js')
#yield('js')
#stop
Error:
ErrorException (E_ERROR) Undefined variable: adminlte (View:
/home/unidas/intranet/resources/views/vendor/adminlte/page.blade.php)

how to set html layout in loop

I want to set a html layout view in a loop for multiple categories. My html code is here...there were many of categories came from (wp-admin) woocommerce. Given code is layout of how to show my categories in home.php so i want to add more categories in home.php through loop.Thanks
My html code is So far...
<div class="selected-products-wrapper clearfix">
<div class="category-list">
<span class="category-main" style="background-color: #5D973E">
<div class="category-main_logo">
<img src="" alt="" class="v-middle"></div>
<span class="category-main-title">
<a href="<?php
echo get_term_link($cat->slug, 'product_cat');
?>">
<?php echo $cat->name; ?></a></span>
<div class="category-main-yakataheader"><img src=""></div>
</span>
<ul class="sub-category-list">
<li><?php echo $sub_category ->name; ?></li>
</ul>
View all
</div>
<div class="images-list">
<a href="" class="large-img">
<img src="" alt="Confectionery"
class="v-middle lazy-img" height="351" width="290">
</a>
<span class="small-img-block">
<a href="">
<img src="" alt="Fruits & Veggies"
class="v-middle lazy-img" height="175" width="171">
</a>
<a href="">
<img src="" alt="Noodles"
class="v-middle lazy-img" height="175" width="171">
</a>
</span>
<span class="center_img-block">
<a href="">
<img src="" alt="Oats"
class="v-middle lazy-img" height="175" width="344">
</a>
<a href="">
<img src="" alt="Ofada"
class="v-middle lazy-img" height="175" width="344">
</a>
</span>
<span class="small-img-block last-img-block">
<a href="">
<img src="" alt="Cooking Oils"
class="v-middle lazy-img" height="175" width="171">
</a>
<a href="">
<img src="" alt="Seasoning"
class="v-middle lazy-img" height="175" width="171">
</a>
</span>
</div>
<div class="alt-images-block">
Fruits & Veggies
Noodles
Cooking Oils
Seasoning
</div>
</div>
you need to create a custom php function with the data you want repeat.
e.g.
<?php
function repeat_category(){ ?>
//your html code you want to repeat goes here.
<?php } ?>
Then you can just use
<?php
repeat_category();
?>
Wherever you want your html code to appear.

Boostrap thumbnail slider load dynamic conent

I have a thumbnail slider on index page
<div class="productslider carousel slide data-slider" id="prod158">
<div class="carousel-inner">
<div class="item active">
<ul>
<li class="product col-sm-2">
<a href="#" alt="">
<img src="#" width="160" height="120" alt="loading">
<span>Title</span>
</a>
<span class="text">Price</span>
</li>
</ul>
</div>
<a data-slide="prev" href="#prod158" class="left carousel-control">
<span class="prev_btn"></span>
</a>
<a data-slide="next" href="#prod158" class="right carousel-control">
<span class="next_btn"></span>
</a>
</div>
So how do I load dynamic data on this slider (where & how i pleased foreach loop).
Note :
This is a laravel project.if you use blade syntax,then i will more helpful.
li should be looped five times.
if there is 10 products then item class should be looped 2 times.
Data Source : Product::all();
<div class="productslider carousel slide data-slider" id="prod158">
<div class="carousel-inner">
#foreach(array_chunk($products,5) as $row)
<div class="item active">
<ul>
#foreach($row as $product)
<li class="product col-sm-2">
<a href="#" alt="">
<img src="#" width="160" height="120" alt="loading">
<span>Title</span>
</a>
<span class="text">Price</span>
</li>
#endforeach
</ul>
</div>
#endforeach
<a data-slide="prev" href="#prod158" class="left carousel-control">
<span class="prev_btn"></span></a>
<a data-slide="next" href="#prod158" class="right carousel-control">
<span class="next_btn"></span></a>

Bootstrap 3 dropdown button height and search

I'm having a little problem with bootstrap 3. I tried for the whole day to solve and searched everything in internet even used FireBug but didn't help.
The button of dropdown is higher than the menu and its going outside the menu.
<ul class="nav navbar-nav navbar-right">
<?php if(!is_array(session( 'thisUser'))): ?>
<span class="glyphicon glyphicon-user"></span> <?php echo T('Register') ?>
<span class="glyphicon glyphicon-log-in"></span> <?php echo T('Login') ?>
<?php else: ?>
<li class="dropdown">
<a class="dropdown-toggle text-notransform" data-toggle="dropdown" href="#">
<img src="<?php echo URL(session_get('preferences', 'avatar')) ?>" width="24px">
<?php echo session_get('thisUser', 'username') ?> <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<div class="navbar-login">
<div class="row">
<div class="col-lg-4">
<p class="text-center">
<img src="<?php echo URL(session_get('preferences', 'avatar')) ?>" width="200px">
</p>
</div>
<div class="col-lg-8">
<p class="text-left"><strong><?php echo session_get('thisUser', 'username') ?></strong>
</p>
<p class="text-left small">
<?php echo session_get( 'thisUser', 'email') ?>
</p>
<br />
<p class="text-left">
<a href="<?php echo URL(T('setting-slug', 'settings')) ?>" class="btn btn-primary btn-block btn-sm">
<?php echo T( 'Settings') ?>
</a>
<?php echo event( 'user_menu', '') ?>
</p>
</div>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="navbar-login navbar-login-session">
<div class="row">
<div class="col-lg-12">
<p>
<a href="<?php echo URL('logout') ?>" class="btn btn-danger btn-block">
<?php echo T( 'Logout') ?>
</a>
</p>
</div>
</div>
</div>
</li>
</ul>
</li>
</ul>
<?php endif; ?>
</ul>
My second problem is with the bootstrap search I want the button search to be next to the search text not bellow it. The code is PHP function:
function search_box($a){
$return .= Form::open(array('method'=>'GET', 'action'=>URL(T('directory'))));
$return .= Form::input('q', R('q'), array('class'=>'form-control input-md', 'style'=>'margin-bottom:5px','placeholder'=>T('Type smth to search')));
$return .= '<button type="submit" class="btn btn-block btn-md btn-primary"><i class="icon-find"></i> '.T('Search').'</button>';
$return .= Form::close();
$return .= '<div class="clearfix"><br /></div>';
return $return;
}
(For image of the search is the same as the above link)
Can someone tell me how to fix this. Thanks in advance.
On your searchbox($a) function, try removing btn-md class from button.

Categories