i just want to put the name of the slider image inside foreach loop and all of it is inside css "backgound:image:url()" i want to write the php code inside background-image like css
background-image: url({{url('sliderimages/'.$slider->slider)}});
it dosn't display images
i when i am using asset it didn't work i don't know why please help
here is my foreach blade code
<div class="col-xs-12 col-sm-12 col-md-9 homebanner-holder">
<!-- ========================================== SECTION – HERO ========================================= -->
#foreach ($sliders as $slider)
<div id="hero">
<div id="owl-main" class="owl-carousel owl-inner-nav owl-ui-sm">
<div class="item" style="background-image: url(asset('sliderimages/'$slider->slider));">
<div class="container-fluid">
<div class="caption bg-color vertical-center text-left">
<div class="slider-header fadeInDown-1">{{$slider->title}}</div>
<div class="big-text fadeInDown-1"> New Collections </div>
<div class="excerpt fadeInDown-2 hidden-xs"> <span>{{$slider->description}}</span> </div>
<div class="button-holder fadeInDown-3"> Shop Now </div>
</div>
<!-- /.caption -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /.item -->
#endforeach
<!-- /.item -->
</div>
<!-- /.owl-carousel -->
</div>
If it's in public styles folder:
background-image: url("{{ asset('sliderimages/'.$slider->slider) }}");
in other pathes:
background-image: url("{{url('sliderimages/'.$slider->slider)}}");
Related
Laravel Crud operation
When i open the edit option initially from button link it shows me blank screen as attached in both browser Chrome and FireFox
But when i reload it from the URL by hitting enter it loads the screen
Also when i save the form it return me the GIF image in ajax response.
the module name is advertisement
Is there possibilities the word advertisement can cause the issue?
AdvtController.php
public function edit($uuid)
{
Languages::setBackLang();
$checkPermission = Permissions::checkActionPermission('edit_advertisement');
if ($checkPermission == false) {
return view('backend.access-denied');
}
$advertisementData = Advertisement::loadAdvertise($uuid, Languages::EN);
if (empty($advertisementData)) {
Helper::log('Advertisement edit : No record found');
return redirect()->back()->with('error', trans('backend/common.oops'));
}
$languages = Languages::where('language_id', Languages::EN)->select('language_id', 'name')->first();
$language_id = Languages::getBackLanguageId();
return view('backend.advertisement.edit', compact('languages', 'advertisementData'));
}
edit.blade.php
#extends('backend.layout')
#php
$lang = \App\Models\Languages::getBackLang();
#endphp
#section('scripts')
<script src="{{asset('backend/dist/js/jquery.validate.min.js')}}"></script>
<script src="{{asset('backend/dist/js/pages/custom.js')}}"></script>
<script src="{{asset('backend/dist/js/pages/advt.js')}}"></script>
#endsection
#section('content')
<div class="content-wrapper">
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark">{{trans('backend/advertisement.advertisement')}}</h1>
</div><!-- /.col -->
<div class="col-sm-6">
<ol class="breadcrumb {{($lang == 'ar') ? 'float-sm-left':'float-sm-right'}} ">
<li class="breadcrumb-item">{{trans('backend/common.home')}}</li>
<li class="breadcrumb-item">{{trans('backend/advertisement.advertisement')}}
</li>
<li class="breadcrumb-item active">{{trans('backend/common.edit')}}</li>
</ol>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</section>
<!-- /.content-header -->
<section class="content">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">{{trans('backend/advertisement.edit_advertisement')}}</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<div id="display_message" class="col-md-12 display-none">
<div class="alert display-none alert-success"></div>
<div class="alert display-none alert-danger"></div>
</div>
#include('backend.advertisement.form')
</div>
<!-- /.card-body -->
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</section>
</div>
#endsection
**Using Laravel 5.8.31 & Bootstrap 4. Browser: Chrome v. 76.0.3 and Opera 62.0.33 **
I was testing my CRUD functions by deleting a post. After deletion, the controller redirects back to my post index page. When the page loaded, the bootstrap side bar wrapped down below the other posts, rather than being on the right. Was fine before the post deletion.
I tried altering the cols and floating elements to no avail. Using Chrome dev tools, I see that the sidebar is nested in an em tag that isn't in the code. Tried clearing application cache. No effect.
I suspect this has something to do with the blade templating language and parsing the html, although if it is, I have no idea how to fix this other than manually installing the sidebar on every page.
How do I fix this??
Code can be found here: https://github.com/gkennedy87/Hillcrest/tree/master/resources/views
(It seems that laravel is also wrapping the footer in an em tag. Although this is a non-issue at the moment)
// views/posts/index.blade.php
#extends('layouts.app')
#section('content')
#include('inc.navbar')
<div class="container">
<div class="row">
<div class="col-md-8 col-lg-8">
<h1>Our Blog</h1>
#if (count($posts) > 0)
#foreach ($posts as $post)
<div class="card mb-4">
<img class="card-img-top" src="http://placehold.it/750x300" alt="Card image cap">
<div class="card-body">
<h2 class="card-title">{{$post->title}}</h2>
<p class="card-text">{!! str_limit($post->body,200,'...')!!}</p>
Read More →
</div>
<div class="card-footer text-muted">
Posted on {{$post->created_at}} by
Start Bootstrap
</div>
</div>
#endforeach
{{$posts->links()}}
#else
<p>No Posts Found</p>
#endif
</div>
#include('inc.sidebar')
<!--end row -->
</div>
<!--end container -->
</div>
#include('inc.footer')
#endsection
// views/inc/sidebar.blade.php
<!--sidebar start -->
<div class="col-md-4 col-lg-4">
<div class="sticky">
<!-- Search Widget -->
<div class="card my-4">
<h5 class="card-header">Search</h5>
<div class="card-body">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button">Go!</button>
</span>
</div>
</div>
</div>
<!-- Categories Widget -->
<div class="card my-4">
<h5 class="card-header">Categories</h5>
<div class="card-body">
<div class="row">
<div class="col-lg-6">
<ul class="list-unstyled mb-0">
<li>
Web Design
</li>
<li>
HTML
</li>
<li>
Freebies
</li>
</ul>
</div>
<div class="col-lg-6">
<ul class="list-unstyled mb-0">
<li>
JavaScript
</li>
<li>
CSS
</li>
<li>
Tutorials
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- Side Widget -->
<div class="card my-4">
<h5 class="card-header">Side Widget</h5>
<div class="card-body">
You can put anything you want inside of these side widgets. They are easy to use, and feature the new Bootstrap 4 card containers!
</div>
</div>
</div>
</div>
<!-- sidebar end -->
I setup the app on a local environment, the sidebar always stays on the right even after deleting a post. The response also doesn't contain any em tags. Could you try clearing the cache:
php artisan cache:clear
php artisan view:clear
php artisan config:clear
I've created a file called menu.php to be my universal nav/menu file. The way it was created using bootstrap though, I have a div called article at the bottom which serves as the main body of the app, since the sidebar in my menu is expandable/responsive.
I really want to have one global menu file. I'm currently including it in all of my content pages like so:
<?php include("menu.php")?>
This works but it breaks my formatting. What I'm trying to do is make all of my main pages such as index.php have the html formatted so that it will always sit inside the tag in my code below which shows card classes.
<header>
<div class="branding">
<div class="menu-button menu-toggle nav">
<i class="material-icons">menu</i>
</div>
<img src="" />
</div>
<div class="page-details">
</div>
<div class="settings">
<div class="menu-button profile">
<i class="far fa-user-circle fa-2x"></i>
</div>
<div class="menu-button menu-toggle aside">
<i class="material-icons">chat</i>
</div>
</div>
</header>
<div class="app">
<nav>
<div class="title-block">
<img src="" />
</div>
<ul>
<li><a href="#"><i class="material-icons">home</i>
<span>Home</span></a></li>
</ul>
</nav>
<!--This following article section is the main body of the page, that I want each additional page to take up-->
<article>
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
<div class="card"></div>
</article>
</div>
Example:
Menu.php is my global menu/nav file but it makes the page/app act as a wrapper for all the other pages (index.php, editor.php, etc.)
menu.php
<div class="app">
<nav>
Nav menu content
</nav>
<article>
This will be the main page article for index.php, editor.php,etc.
</article>
</div>
example with index.php (the start and end are just hypothetical to show the endpoints)
<body>
<?php include("menu.php");?>
<?php start('article') ?>
<!--Everything from here to the end() call would be inserted in the article tags on menu.php-->
<div class="app">
<div id="content">
<div>
<h1 style="text-align: center; color: #A9BD50; ">Content Management Editor</h1>
</div>
<form method="post">
<textarea id="mytextarea"></textarea>
</form>
<div>
<h1 style="text-align: center; color: #A9BD50; ">Preview</h1>
</div>
</div>
</div>
<?php end() ?>
</body>
I am trying to make the footer of my website. I want to change the style.
1) Can I create a custom stylesheet and include it into the footer file?
If yes, Do I need to create a new div for any element I want to choose or can use the class provide by Bootstrap?
For example, above I created a div and than in the style file I added #mydiv?
Or there is a better solution?
<div id="mydiv">
<footer class="container-fluid" style="margin-top: 30px;">
<div class="row">
<div class="col-md-4"><img src="<?php echo get_template_directory_uri();?>/img/footer_logo.png"></div>
</div>
<div class="row">
<div class="col-md-4"><img src="<?php echo get_template_directory_uri();?>/img/ico.png"></div>
</div>
<div class="row">
<div class="col-md-4">
xx
xxx
xxx
xxx[enter image description here][1]
</div>
</div>
<div class="row">
<div class="col-md-4">2004-2017. All
rights reserved.</div>
</div>
</footer>
</div>
In addition to Bootstrap classes you can apply your own like
<footer class="container-fluid my-custom-class" style="margin-top: 30px;">
Then just select this class in CSS and apply the styling you need. Be careful, as some attributes (like width ) can be overwritten by Bootstrap.
Hope this helps.
I have a problem,
When I tried to list all users, to get their username/and others script didn't continue to read anything, it has stopped just after my echo input.
So when I put echo to get user's info it reads that input but it doesn't read anything after. See bellow there is a echo called 'userEmail' and it reads it with no problems but it doesn't go after signature. Now I have checked any everything works when i put it on a plain page but for some reason it stop readsing here. I'm a newbie in this PHP so yeah. :)
<?php
$query = mysql_query("SELECT userEmail FROM users");
while($userRow= mysql_fetch_array($query)){
echo '<div class="col-md-4">
<!-- Widget: user widget style 1 -->
<div class="box box-widget widget-user">
<div class="widget-user-header bg-blue" style="background-color: center center;">
</div>
<div class="widget-user-image">
<img alt="User Avatar" class="img-circle" src="//">
</div>
<div class="box-footer">
<div class="row">
<div class="col-sm-4 border-right">
<div class="description-block">
</div>
<!-- /.description-block -->
</div>
<!-- /.col -->
<div class="col-sm-4 border-right">
<div class="description-block">
<h5 class="description-header">'.$userRow['userEmail'];'</h5>
<h5 class="description-text">'.$userRow['userSignature'];'</h5>
</div>
<!-- /.description-block -->
</div>
<!-- /.col -->
<div class="col-sm-4">
<div class="description-block"></div>
<!-- /.description-block -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
</div>
<!-- /.widget-user -->
</div>
<!-- /.col -->
</div>';
}
?>
You're ending your echo with a ;. You need to concatenate the string with a . instead:
<h5 class="description-header">'.$userRow['userEmail'];'</h5>
<h5 class="description-text">'.$userRow['userSignature'];'</h5>
This should be:
<h5 class="description-header">'.$userRow['userEmail'].'</h5>
<h5 class="description-text">'.$userRow['userSignature'].'</h5>
in
'.$userRow['
quates are conflict with together
change ' and " with together in all lines of your script
and then :
".$userRow['userEmail']."<
be sure will be ok