Stylesheet not getting attached in Codeigniter - php

I am new to CI and I tried to use the normal HMTL file as template. So I made a folder in 'application/views' named 'education'. I made a header.php, navigation.php, content.php and footer.php file. In the controller I wrote
class Education extends CI_Controller {
function index() {
$this->load->view('education/header');
$this->load->view('education/navigation');
$this->load->view('education/content');
$this->load->view('education/footer');
}
}
Then I accessed the link like "http://localhost:8080/mvc/index.php/education/"
But the stylesheet is not getting attached, which is in the same folder as the files. I also tried changing the href of the stylesheet link to "echo base_url();application/views/education/style.css". But it din't work either.
Any help
thanks

You shouldn't keep style sheets/js files/images in your application folder.. Keep them outside the application folder in some folder like "static" and access them using base_url()
A good file/folder structure would be the below:
website_folder/
–––– application/
–––––––– config/
–––––––––––– autoload.php
–––––––––––– config.php
–––––––––––– ...
–––––––– controllers/
–––––––––––– examples.php
–––––––––––– index.html
–––––––––––– welcome.php
–––––––– ...
–––––––– views/
––––––––---- templates/
––––––––-------- backend.php
––––––––-------- frontend.php
–––––––––––– ....
–––––––––––– example.php
–––––––––––– index.html
–––––––––––– welcome_message.php
–––– assets/
–––––––– css/
–––––––– js/
–––––––– images/
–––––––– templates/
––––––––---- frontend/
––––––––-------- css/
––––––––-------- js/
––––––––-------- images/
––––––––---- backend/
––––––––-------- css/
––––––––-------- js/
––––––––-------- images/
–––––––– uploads/
–––––––– index.html
–––– system/
–––– user_guide/
–––– index.php
–––– license.txt
Refer this and this..

File: (your_site)/application/views/education/header.php
....
<LINK href="/static/some.css" rel="stylesheet" type="text/css">
....
File (your_site)/static/some.css
....
some styles
....

Related

How to override errors templates for Symfony

I want to override the error templates in Symfony 3. I've started by creating a TwigBundle folder withe the personalised twig.
app/
└─ Resources/
└─ TwigBundle/
└─ Exception/
├─ error404.html.twig
├─ error403.html.twig
├─ error.html.twig
Then I checked the routing_dev file which contains this lines :
_errors:
resource: "#TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
Symfony still displays the default error templates. I want to know if I should verify something else.
PS : I have already checked this documentation : How to Customize Error Pages
EDIT :
The overriden files should reside in a subfolder named views. The correct file tree would look like this:
app/
└─ Resources/
└─ TwigBundle/
└─ views/
└─ Exception/
├─ error404.html.twig
├─ error403.html.twig
├─ error.html.twig
Clear your cache afterwards.
Be aware that those overriden error templates do NOT show up in the dev environment.
If you want to test the templates in your dev environment you must ensure you have imported the following in routing_dev.yml:
_errors:
resource: "#TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
Now you can access /_error/<error-code>.html (i.e. localhost:8000/_error/404.html with the integrated webserver)

Which framework is used: PHP MVC

I got a code to resolve some errors. But can't figure out which framework or row php is used. Some codes were done in the structure of MVC. Can anybody help me to recognize it?
If anyone help me it will be great help for me.
I am providing the structure of my code:
Main Folder/
admin/
controllers/
htdocs/
logs/
views/
config.php
log4php.properties
require.php
common/
_common-chk.php
_common-config.php
common-chk.php
common-config.php
common-func.php
framework/
mvc/
libs/
manage/
controllers/
htdocs/
logs/
views/
config.php
log4php.properties
require.php
models/
dao/
public/
controllers/
htdocs/
logs/
views/
config.php
log4php.properties
require.php

Website cache folder, best location? Inside or outside webroot?

I am curious if there is a best practice concerning the location of a website's cache folder (templates, images, etc)?
I often see it residing in the webroot with index.html/index.php like so,
Server
`-- /var/
`-- www/
-- example.com/
|-- .git/
|-- public_html/
| |-- cache/
| |-- assets/
| `-- index.html
|-- src/
|-- test/
|-- .gitignore
`-- package.json
However, would it be considered bad practice or create any security concerns if I place the cache folder up one level with the rest of the private project files (.git, node_modules, etc)? Like so...
Server
`-- /var/
`-- www/
-- example.com/
|-- .git/
|-- cache/
|-- public_html/
| |-- assets/
| `-- index.html
|-- src/
|-- test/
|-- .gitignore
`-- package.json
Apologies if this isn't a question for here, but I wasn't able to find much information on best practices regarding project folder structure for the cache. The only stuff I could find was about best practices on using the browser cache and other caching tools.
Thanks!

Doctrine - Configure Entities in more than one directory

I'm starting in Doctrine 2.4 and I'm developing a system where I separate the core files and application files, as follows:
/ root
    |-- /Src
         |-- / App
               |-- /Model
                     |- ** (Application Entities) **
         |-- /Core
               |-- /Model
                     |-- ** (Core Entities) **
In the Doctrine documentation shows the following form to set 1 directory for Esntitys:
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__. "/src"), $isDevMode);
But when I have to configure more than one directory that will contain the Entitys of my application, how to proceed?
Thanks in advance!
I found a way to resolve the issue. Simple!!!
Put like this:
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/src/App/Model/", __DIR__."/src/Core/Model/"), $isDevMode);

Configure Yii to generate CRUD(Gii) in themes folder

In a Yii project I have the structure:
project/
... default Yii structure here ...
themes/
css/
font/
images/
js/
views/
admin/
layouts/
site/
How to configure Gii to generate CRUD in themes folder?

Categories