i need help in this situation , i am embedding a slideshow using wowslider ... its included through the index.php file
<div class="content">
<?php
include 'includes/aside.php';
include 'includes/widgets/slideshow.html';
?>
</div>
Link of the broken images
Direct link for the slideshow , works properly
(Note : this is just a test slideshow not the final one . )
try it
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include "$root/includes/aside.php";
include "$root/includes/widgets/slideshow.html";
***change the links in slider to absolute links.
Related
I am creating a template and someone has created the orignal slider using
<div class="item active" style="background-image: url(../images/slider/bg1.jpg)">
My question is I am using Joomla to create this template how do i echo in the above html so that I can output the full url of site for at min its not finding the image.
<?php echo $this->baseurl ?>/
You can use
JUri::base()
accepting an optional parameter (true or false)
to include the protocol and site name.
I want to use the bootstrap half-slider carousel and I am using codeigniter. In it, it used <div> with background-image instead of <img>, like this
<div class="fill" style="background-image:url('http://placehold.it/1900x1080&text=Slide One');"></div>
In my view used it like this:
<div class="fill" style="background-image:url('../assets/images/image1.jpg')"></div>
However, it doesn't show the image.
Your help will be much appreciated.
Not sure how you have structured your view files, but the reason why the first one is working is probably because it have an absolute path for the image ('http://placehold.it/1900x1080&text=Slide One')
Try using an absolute path to you image in the assets folder.
Instead of:
<div class="fill" style="background-image:url('../assets/images/image1.jpg')"></div>
Try:
<div class="fill" style="background-image:url('<?=base_url('assets/images/image1.jpg')?>')"></div>
I have a picture in folder common that i want to show in view, but it doesn't shown.
My code is :
<img src="<?= Yii::$app->request->baseUrl . '/common/web/img/ava.jpg' ?>" class=" img-responsive" >
It's generated to be <img src="/simdsm/common/web/ava.jpg" class=" img-responsive"> but the image does not appear.
How to fix it?
Since no one actually posted an example of using assets to access files saved in a backend-folder or the other way around, it's quite simple:
Let's say you are working with the yii advanced template and you have a backup/web/uploads/ folder in which you save images uploaded via your backend. Now you'd like to display those images on your frontend. Since the Frontend-App and the Backend-App are two seperate Applications, they don't know of each other.
You create a new asset in your frontend/assets/, let's call it BackendAsset.php:
<?php
namespace frontend\assets;
use yii\web\AssetBundle;
class BackendAsset extends AssetBundle {
public $sourcePath = '#backend/web/uploads';
}
where $sourcePath is the backend-folder (source) you'd like to access on the frontend. The #backend alias is predefined in the advanced template, so we'll use it.
Now in our view we can simply use the BackendAsset:
<?php
use frontend\assets\BackendAsset;
$backend = BackendAsset::register($this);
?>
and now we can easily display a file, let's say backend/web/uploads/somefile.jpg:
<img src="<?= $backend->baseUrl . '/somefile.jpg' ?>" >
NOTE: Using the asset in this way copies all the files from the backend/web/uploads to an asset folder in the frontend. To prevent that, you can tell your application not to copy the files, but to link to them (creating SymLinks) instead, using linkAssets (yii2 docu):
In your app configuration (in this case frontend/config/main.php), set the linkAssets parameter to TRUE:
'components' => [
'assetManager' => [
'linkAssets' => true,
]
]
In case of using advanced application template, images should be placed in these web accessible folders - frontend/web or backend/web.
Also usually I create alias from frontend/web/images to backend/web/images to display images in backend from frontend.
What you mentioned is not web accessible directory.
Alternative way to publish images from such directory will be creating asset bundle for that folder, that way images will be copied in frontend/web/assets for example. You can read more about asset bundles in official docs.
We can do it easily by simple step of below
In common/config/params-local.php
Yii::setAlias('#imageurl', 'http://localhost/project_name/backend/web/');
in above example i have my image under backend/web/images/product_images
In frontend, i am getting like,
<img src="<?php echo Yii ::getAlias('#imageurl'); ?>/images/product_images/<?= $product['image']?>" alt=" " class="img-responsive" />
it's simply working for me...
I'm trying to integrate Codeigniter and Filterable but I cant find much information about it. I have a page with many results and I want to filter the results, for example by the column "name" or "id". I have worked with Filterable before, but never had to do it with Codeigniter.
I tried to put the files on the root. Also in the folder "Application", even tried putting it on the same folder as the view. But in any of these cases I cannot link the files and get it to work.
The ways I've been trying to link the scripts are the following:
<script src="<?php echo site_url('src/filterable.js')?>"></script> This was with the scripts in application folder
<script src="./src/filterable.js"></script> Scripts on root
<script src="<?php echo site_url('admin/src/filterable.js')?>"></script> Scripts on view folder
Is there another way to achieve this? Or maybe another library I could use for it?
Here is how I like to deal with assets.
I create an helper called assets_helper in application/helpers/
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
if ( ! function_exists('js'))
{
function js($nom)
{
return '<script src="' . base_url() . 'assets/js/' . $nom . '.js" type="text/javascript" ></script>';
}
}
//This is only the part that handle js as it is what's bothering you
Here is the full helper I use : http://pastebin.com/ujETEXJ4
After that, at the same level as index.php I create those folder :
|-Application
|-System
|-index.php
|-Assets
|- css
|- sass
|- images
|- js
Put all the js file you need in your new js folder.
In my application/config/autoload.php I add my new helper
$autoload['helper'] = array('assets', ...);
Finally, in the footer of my page(s) :
<?= js('myjsfile'); ?> //I did not forgot the extension, it's how it works :)
Which will give at the end :
<script src="http://www.example.com/assets/js/myjsfile.js" type="text/javascript" ></script>
Thanks AdrienXL for your answer. I tried to follow your suggestion but in the end I couldn't make it work. For some reason Codeigniter didn't recognize the files I tried to reach.
So after a long searching I ran across a library called Datatables http://www.datatables.net/ it has the option to load the scripts locally or remotely, so just added the link to the scripts needed to the type of filter I had to implement and in the end this last option was what allowed me to make the filters work.
I'm using default joomla mod_banner.
I'd like to modify the module so can give specific css class for each banner image, so if the module displaying 3 banner images, the first banner (image) will have class="banner1", the second image will have class="banner2" the third image will have class="banner3" and so on.
How can I do that?
If you decide to modify your mod_banners module, then just follow the steps:
Open the /modules from your root directory.
Find the directory named mod_banners in modules/mod_banners
Find out the tmpl directory modules/mod_banners/tmpl
default.php is the file that display the images into the frontend of you joomla website.
just edit this file. See the img tag into and just change whatever name you want to give the class..
UPDATE : Take a look on the given Codes:
// Add variable before
$unique_number = 1;
// Provide the Provides the images URL or related information
foreach($list as $item):
now just find out the <img tag and just add a class something like
<img class='banner-<?php echo $unique_number?>'
and at the end of the file findout the endforeach; and just add the code something like
<?php
$unique_number++;
endforeach;
?>
providing you the class name like banner-1, banner-2, .... etc.
IMPORTANT: If you notice on the top most of your default.php the module provide the images into an array, If you are familiar with the Joomla modules structures then you can modify it easily.