Welcome Guest, Not a member yet? Register   Sign In
Template Library Version 1.4.1
#91

[eluser]mariek[/eluser]
Hi,
I'm newbie and I'm stuck : I made a simple template with a css link.
My template is in the views folder, and I put my CSS in a folder named css in views
My code is :
<link rel="stylesheet" type="text/css" href="css/styles.css" />
The css file is not loaded. I tried this :
<?php echo base_url(); ?>css/styles.css
but I have an error :
Call to undefined function base_url()

I have no idea of what to do, can someone help me please ?

Thx,
Marie
#92

[eluser]Colin Williams[/eluser]
Your css path should be relative to the URI, not your views folder.

Examples:

At http://www.example.com/, 'css/style.css' would point to http://www.example.com/css/style.css (by "point to" I mean that is what file the browser will request).

At http://www.example.com/news/2009/02/16/, 'css/style.css' would point to http://www.example.com/news/2009/02/16/css/style.css

See the breakdown? This is why using relative paths in template files is a no-no.
#93

[eluser]goliatone[/eluser]
[quote author="mariek" date="1243387935"]Hi,
I'm newbie and I'm stuck : I made a simple template with a css link.
My template is in the views folder, and I put my CSS in a folder named css in views
My code is :
<link rel="stylesheet" type="text/css" href="css/styles.css" />
The css file is not loaded. I tried this :
<?php echo base_url(); ?>css/styles.css
but I have an error :
Call to undefined function base_url()

I have no idea of what to do, can someone help me please ?

Thx,
Marie[/quote]

Have you loaded the url helper?
You do so with the following function call in your controller:
$this->load->helper('url');

You can also autoload it.

Helper functions
Autoloading resources

hope that helps.
#94

[eluser]mariek[/eluser]
[quote author="goliatone" date="1243394303"]
Have you loaded the url helper?
You do so with the following function call in your controller:
$this->load->helper('url');

You can also autoload it.

Helper functions
Autoloading resources

hope that helps.[/quote]

Thx goliatone, I loaded the url helper (nice helper, I'll remember it) and I don't have the undefined error message anymore.
But my css is still not loaded. The url in the navigator source is :
http://127.0.0.1/myprojet/css/styles.css

Any idea ?
#95

[eluser]Colin Williams[/eluser]
This is not a Template related issue, and this topic has been exhaustively discussed on the forums. Try doing a search or starting a new topic.
#96

[eluser]mariek[/eluser]
[quote author="Colin Williams" date="1243431917"]This is not a Template related issue, and this topic has been exhaustively discussed on the forums. Try doing a search or starting a new topic.[/quote]

Ok, thank you
#97

[eluser]warrennz[/eluser]
Heya guys

I've had a bit of a look but could not find anything so apologies if its been discussed before etc!

Is there a way to embed a template into another templates region? And have that embeded template work entirely on its own.

I guess I could create a second template object, set the different template, run through that, then apply that back to the parent templates region? I think..

I have different nested page layouts/styles that all utilize the same html for top and bottom (not the head etc) sections of the time. Each one of templates has the same code that needs updating when I make changes. One view might have a 3 column layout, while another might have a 2 row layout. Those 2 views share the exact same header(ing), navigation, etc etc. The layouts are quite nested within the applications final view so its alot of html to reuse.

It would be ideal if the nested view in the parent template could have its own regions etc.

Any help much appreciated!

Thanks! and love this project so far.
#98

[eluser]countofzero[/eluser]
This seems like it should be simple, but so far I it has gotten the best of me.

How does on use html anchors for jumping around the page when using this template
library?


Thanks.
#99

[eluser]Colin Williams[/eluser]
Quote:Is there a way to embed a template into another templates region?

It is possible. Just like views, you can get the rendered template in a string and then write that to another template's region. I think it might be better to just use write_view and not 2 templates. Seems like overkill.

Quote:How does on use html anchors for jumping around the page when using this template
library?

Just create anchor links in your views. Nothing needs to be done with the Template class itself.

Code:
<div id="section2">Hola, compadres</div>
<a href="#section2">Jump to Section 2</a>

[eluser]countofzero[/eluser]
[quote author="Colin Williams" date="1244247011"]

Quote:How does on use html anchors for jumping around the page when using this template
library?

Just create anchor links in your views. Nothing needs to be done with the Template class itself.

Code:
<div id="section2">Hola, compadres</div>
<a href="#section2">Jump to Section 2</a>
[/quote]


Please take a look at the following link. It works fine in IE, but not Firefox.

http://www.hobokencup.com/template.htm

Could it be related to the css techniques used in the style?




Theme © iAndrew 2016 - Forum software by © MyBB