Joomla Template and Foundation 5 Framework - joomla

I have created a basic template for Joomla using Foundation 5 Framework but the call to include Foundation and jQuery and the call to fire Foundation needs to be the last part that is loaded.
<script src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/bower_components/foundation/js/foundation.min.js"></script>
<script src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/bower_components/jquery/jquery.js"></script>
<script src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/app.js"></script>
So I have added them into the template and they can be navigated to when I load the template up but for some reason foundation does not exist according to firebug and won't load.

If Firebug is saying that the file does not exist then you have used the incorrect path. As for the importing of jQuery, I would recommend you use the Joomla standards for this which will also import the file that comes package use noConflict() mode like so >> JHtml::_('jquery.framework');
Also try using the addScript() method for importing your other scripts, however please ensure that the paths are correct. So your full code will look like this:
<?php
JHtml::_('jquery.framework');
JHtml::_('script', JUri::root() . 'templates/template_name/bower_components/foundation/js/foundation.min.js');
JHtml::_('script', JUri::root() . 'templates/template_name/js/app.js');
?>
Currently, your .js files are within the template folder, however are within different sub-folders, thus I would recommend sticking to 1 main folder for all javascript files.
Update:
I have just tested Foundations and it works fine for me. First of all, you need to ensure that jQuery is loaded first. Add the following code before the ending ` tag in your template index.php file:
<script src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/bower_components/jquery/jquery.js"></script>
<script src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/bower_components/foundation/js/foundation.min.js"></script>
<script> $(document).foundation(); </script>
Hope this helps

Related

Img Src path adding / when using .SVG in Cakephp

For some reason unknown to me when I try to use a .svg file in the image src path cakephp adds an additional / to the file path which shows the image as missing.
example:
<img src="<?php e($html->url('/img/mobile/shark.svg')); ?>"
outputs:
<img src="host/img/mobile/shark.svg/"
It then thinks the file is not there. But when I remove the / in chrome inspect the file appears. Anyone see this issue before?
Update 5/1
On Cake 1.3, and beyond our control at the moment to update. These helpers just break the page =( and after looking at the documentation for 1.3 it looks like it should not.
Create a image tag using cakephp helper,
<?php echo $this->Html->image('example.svg', array('alt' => 'CakePHP')); ?>
Output will be
<img src="/img/example.svg" alt="CakePHP" />
Look HtmlHelper::image(string $path, array $options = array())
You should use the CakePhp HTML helper.
<?php echo $this->Html->image('image.svg', array('alt' => 'image')) ?>

Image not retrieve from folder

I am upload the image into database and folder. But when I am trying to retrieve it it will not working.
My code is as below:
<img src="<?php echo APPPATH.'modules/employee/image/'.#$userdata[0]->photo;?>" />
Give me a solution.
Try:
<img src="<?php echo base_url().'modules/employee/image/'.#$userdata[0]->photo;?>" />
Constant APPPATH will not give you full path, you must need to use base_url() instead, but for using base_url() you also need to define your base_url in config.php

How do I link to a pdf using CodeIgniter?

this is such a simple task, yet I can't seem to get it to load a pdf.
I have a simple link on my view that links to a pdf stored in a downloads folder.
Is there something I'm missing about doing this in CodeIgniter?
<div class="node_title_grant">
<a href="<?php echo base_url();?>index.php/downloads/grant.pdf" target="_blank">
Grant
</a>
</div>
then I have grant.pdf stored in a downloads folder in my application folder.
thanks in advance
Simply do the normal path ...
href="<?php echo base_url(); ?>application/downloads/grant.pdf"
Or:
href="/application/downloads/grant.pdf"
Edit:
I believe .htaccess was the problem. Moving the downloads folder from inside applications to the root directory solved the issue.
You want to use the anchor function here:
<div class="node_title_grant">
<?php echo anchor('downloads/grant.pdf', 'Grant', 'target="_blank"); ?>
</div>
Or, you can pass the filename to base_url:
<div class="node_title_grant">
<a href="<?php echo base_url('downloads/grant.pdf');?>" target="_blank">
Grant
</a>
</div>

Codeigniter base_url() in whack?

I was trying to set up a basic log in form with a following code:
<?=form_open(base_url() . 'main/login'); ?>
However after submitting the form the url shows this:
example.com/main/http//example.com/http//example.com/main/login
So I guess in essence for some reason the base-url is printed twice before the controller/method declaration. If I clear the base url value in my config file then the application works normally. I am however curious on what could cause this. For additional information I am working on xampp with a virtualhost and I have mod-rewrite on with a .htaccess file located at the document root.
CodeIgniter automatically adds the base_url to the action of the form when you use the form helper.
For example, you can use:
<?=form_open('main/login'); ?>
which will produce:
http//example.com/main/login
And a correct URL! Pretty simple! :D
More information at:
http://codeigniter.com/user_guide/helpers/form_helper.html
The file config.php under application/config has the setting:
$config['base_url'] = '';
Give it the folder/directory path. For example:
$config['base_url'] = 'http://localhost/ci_test/';
Don't forget to mention the protocol (http://). Alternatively try the site_url() method instead of base_url() for form opening. Skip it if using the form_open() function:
<form action="<?php echo site_url('main/login'); ?>"> ... </form>
Or
<?php form_open('main/login'); ?>
For more help: http://codeigniter.com/user_guide/helpers/url_helper.html
Not sure about the .htaccess file you have used. But this might be the answer codeigniter: why is that when i echo base_url() in an href attribute of an anchor tag, it echoes twice
Try it by parameter:
<?=form_open(base_url('main/login')); ?>
or
<?=form_open site_url('main/login')); ?>
In order to append the prefix also
You can Use
<?php echo form_open(base_url(main/login)); ?>
You have to use "echo" rather than because it not works in some browsers....

how can I change the header logo to link to an external website in magento?

I'm trying to achieve the following:
our client needs the header logo of his magento site to take him to another website (different domain).. I have tried to alter header.phtml but the link is becoming: www.websitedomain.com/index.php/www.otherdomain.com
what I want is simply to navigate to www.otherdomain.com
how is that possible?
You will want to change the link in the image to go to the appropriate location.
I believe the file should be located in:
/app/design/frontend/yourtemplate/yourtemplate/page/html/header.phtml
use http:// like bellow
http://www.otherdomain.com in your anchor tag
Just in case someone else comes here looking for the answer, in the file named above, at line 105 (v1.9.2) -
Add the url as below
<h1 class="logo"><strong class="no-display"><?php echo $this->getLogoAlt() ?></strong><img src="<?php echo $logo_src ?>" alt="<?php echo $this->getLogoAlt() ?>" /></h1>

Resources