css and js file path change when clicking other page in codeigniter - codeigniter-3

I have working stylesheet in my codeigniter homepage but if i click on another page the file path also change. that's one reason why my stylsheet not working on other page
the filepath loke like this:
localhost/foldernam/controller_name/stylesheet.css
is there any way that if i visit on other page filepath be remain?
i just want the filepath should be like this
localhost/foldernam/stylesheet.css
in my config.php
$config['base_url'] = 'http://localhost/systems/';

add base_url variabel when you include stylesheet.css, for example
<link rel="stylesheet" type="text/css" href="<?= base_url() . "stylesheet.css" ?>">
Add this code on header your html layout

Related

What am I doing wrong that my index file will not render properly as a github page?

I'm trying to use GitHub as required of my class to launch a website. Unfortunately, I have to be doing something wrong. My filepaths in the index.html file are as follows:
link href="/css/style.css" rel="stylesheet"
for the style sheet
Now for the image I'm wanting to use I'm using:
img src="/images/TomEdwards.jpg" alt="Tom Edwards"
and I'm getting this instead at this location:
https://ladywebdevelop.github.io/bioSite/index.html
my file tree looks like this:
css (Folder)
images (Folder)
README.md
index.html
What are my possible solutions, please?
I've tried several different ways in the file path names to access both the stylesheet and the images.
I'm expecting the stylesheet to render correctly with a colored background and the image to appear on the right-hand side under the horizontal navigation list.
I was able to load the stylesheet by changing this:
<link rel="stylesheet" href="/css/style.css">
To this:
<link rel="stylesheet" href="css/style.css">
The stylesheet must be referenced correctly relative to the index file.
As for the image, I don't see it in the application's sources. Are you sure that it's committed to the repository, and located in the right place? The current codes has it here, which looks like a typo:
<img src="TomEdwards/TomEdwards.jpg" alt="Tom Edwards">

Codeigniter: Favicon icon is not loading, checked in all browser

Problem: Favicon Icon is not loading.
I have a folder 'Assets' in the root directory of codeigniter framework.
Assets/images/favicon.png is the path for the favicon icon image.
The image is present at the above mentioned location.
Controller code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class homeController extends CI_Controller {
public function index()
{
$this->load->helper('url');
$this->load->view('header');
}
}
View: header.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>My-site</title>
<link rel="icon" href="<?php base_url();?>assets/images/favicon.png" type="image/png">
</head>
But the image is not coming.
I tried: How to set Favicon in Codeigniter
i.e moved the favicon.png in the root folder. But still it is not working.
I tried below as well:
In controller
$this->load->helper('html');
In view:
<?php echo link_tag('favicon.ico', 'shortcut icon', 'image/ico');?>
still it is not working.
Can anyone please help me out with this??
View source of your page in browser and check if the link tag of favicon is present . Check if favicon image path is proper and try favicon url in browser .

layout errors building github personal site with jekyll

I have been trying to put together my own page at meredithhu.github.io. As you can see, at this point, only the Home page is displaying the correct layout, all other pages' (if you click through the tabs on home page) layouts are off... And I couldn't figure out why and how to fix it...
All the codes are here: https://github.com/meredithhu/meredithhu.github.io.
I defined layouts in the _layouts folder, apparently only the default.html is working... but aren't all others defined the same way? how could none of the other ones work?
Could anyone give me some hints how to fix the problem?
Update your link tag from default layout
<link rel="stylesheet" type="text/css" href="css/main.css">
to this ->
<link rel="stylesheet" href="/css/main.css">
There is a problem with the styles loading, if you just use href="css/main.css" then the browser will use the current level as the base URL, this is why it works for the base url, but not for any other deeper category/page, in _layouts/default.html change the CSS line to:
<link rel="stylesheet" type="text/css" href="{{site.baseurl}}/css/main.css">
Also, in _config.yml, there is a wrong parser, remove the line markdown: shengli so the website loads properly.

Change the Browser title

I am using links to display PDF files. I wish to show the PDF in a new tab so I add target="_blank". This works fine. A new tab is opened but I wish to change the title of the tab.
The link redirects me to this controller code as follows:-
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');
#readfile($file);
The pdf is displayed correctly but there is no view script so I have no control via the script. Is there a header("Browser title: ???") I can use?
TIA Effy
For this problem, I use this trick:
I use a simple html page with an iframe like this:
<html>
<head>
<title>Your PDF Title</title>
<link type="image/x-icon" rel="icon" href="">
</head>
<body>
<iframe src="/module/controller/action/param..." id="ifrm" name="ifrm" width="100%" height="100%">
</iframe>
</body>
</html>
The iframe contains the PDF and the page has title.
Of course, you can use javascript to have a dynamic title
The internal pdfviewer in Firefox seems to fetch the title of the document from the metadata in the pdf.
With for instance Zend_Pdf this metadata can be manipulated.
$title = 'My custom title';
$pdf = Zend_Pdf::load($filepath);
$metadata = $pdf->getMetadata();
$metadataDOM = new DOMDocument();
$metadataDOM->loadXML($metadata);
$domTitle = $metadataDOM->getElementsByTagName('title')->item(0);
$domTitle->nodeValue = $title;
$pdf->setMetadata($metadataDOM->saveXML());
//maybe old style document info:
$pdf->properties['Title'] = $title;//this didn't work for me
echo $pdf->render();
I'm no DOM manipulation expert, but this worked for me with a file created with Illustrator CS5. Freely based on the Zend Framework Documentation. You might need to do some error checking along the way.

Open login for inside modal dialog for Joomla 2.5

So I have a specific page that spawns a modal dialog to login/register. I am using Colorbox, and this is working nicely for me. What I need to do is open ONLY the form and not the entire page with header links and such. I understand this can be fixed by adding '?tmpl=component' or '&tmpl=component' to the end of the url. My problem is that my form is stripped of all styling and is terribly ugly. Is there any way I can go about adding styling back to this form? Thanks in advance.
Yes you can get all styles,
This is happen due to using with tmpl=component Normally Joomla using this layout for printing purpose(Print layout) it have only basic styling compared to your default template index.php.
So you need to get your proper styling for the forms you have to add those style sheet to the component.php inside your template folder.
templates/your_template/component.php
Add your basic template style sheet at the top of the file using same like index.php.
eg:
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/beez_20/css/template.css" type="text/css" />
Then tmpl=component view have proper styles applied.
Hope it helps..
I downloaded the entire FTP and did a search for where the basic stylesheets were being included (general.css and system.css) so that I could add my others for style. This can be found/edited in public_html/templates/system/component.php