how to add site path in xammp localhost - php

i have a source code of a CMS the cms back-end working perfectly but in front-end shows errors the css not working properly i was searching for the solution then find
<!-- language: lang-html -->
<link href="<?php echo $sitepath; ?>/Assets/css/bootstrap.css" rel="stylesheet" media="screen"/>
<link href="<?php echo $sitepath; ?>/Assets/css/font-awesome.min.css" rel="stylesheet"/>
<link href="<?php echo $sitepath; ?>/Assets/css/bootstrap-responsive.css" rel="stylesheet" media="screen"/>
<link href="<?php echo $sitepath; ?>/Assets/css/sitestyles.css" rel="stylesheet" media="screen"/>
has not fixed
and am try to fix in include.php file here is the include file
$sitepath="http://".$_SERVER['HTTP_HOST'];
//Replace with your domain name if you wish
//$sitepath="http://www.example.com";
this code working on my server but while use this code on my localhost xampp to change
$sitepath="http://localhost/cms".$_SERVER['HTTP_HOST'];
//Replace with your domain name if you wish
//$sitepath="http://www.example.com";
still shows the top code css not working the url shows
localhost/cms/localhost/index.php
like this what i do help please

Related

Dynamic link in css stylesheet with PHP variable

I'm building a dynamic page template for wordpress (which means it has to work at least 4 different domain without changing anything like links etc.) and I added a custom css link like this:
<link type="text/css" rel="stylesheet" href="https://mywebsite.com/wp-content/themes/mytheme/css/page-food.css">
I can reach the server home in a variable like $home_path. Or the theme main folder like $theme_path. So is there any possible way to add the href a PHP variable?
I mean
<link type="text/css" rel="stylesheet" href="$theme_path/css/page-food.css">
just add php start and end tags there
<link type="text/css" rel="stylesheet" href="<?=$theme_path?>/css/page-food.css">
wordpress css call in daynamic path
<link href="<?php echo get_template_directory_uri(); ?>/css/fonts.css" type="text/css" rel="stylesheet">

Obscure links in Header

Currently have a site built using SASS, however due to the fact it was not compiling we decided to edit the cw-styles CSS in our DEV environment and upload this to the FTP instead.
This is how we are linking the css in the Head section currently:
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href="/<?php echo SITE_FOLDER; ?>/css/all.css" rel="stylesheet" type="text/css" />
<link href="/common/js/image/swipe.css" rel="stylesheet" type="text/css" />
<link href="/mse/css/cw-styles.css" rel="stylesheet" type="text/css" />
However on uploading this, in the Head section the link to the stylesheet on the Live site has broken, giving us a link that looks like this:
<link href="/mse,_uploads,_all.crush.css,q23409834296+common,_js,_image,_swipe.css+mse,_css,_cw-styles.css+common,_js,_lightbox,_lightbox.css+common,_js,_image,_swipe.css.pagespeed.cc.0Keg4MRi-i.css" rel="stylesheet" type="text/css"/>
Anyone experienced this, or clues as to why this is happening?

Unable to access stylesheets in codeigniter

I am new to the CodeIgniter, however when i try to link bootstrap files to my project blank(white) screen appears.
<link rel="stylesheet" type="text/css" href="<?php echo base_url("assets/css/bootstrap.min.css");?>" >
I put all bootstrap files inside assets folder which is in the same level as root directories as follows
application
assets
css
bootstrap.min.css
system
I tried alternative such as
<link rel="stylesheet" type="text/css" href="<?=base_url();?>assets/css/bootstrap.min.css" >
And
<link rel="stylesheet" type="text/css" href="<?php echo link_tag("assets/css/bootstrap.min.css")?>" >
none of these seems to work, what should i do? someone help me please!
Let's suppose you have a file in the view folder (application/views) called home_view.php and another file in css folder(application/assets/css/bootstrap.min.css).
In order to link your css file into the view you need to add this line in your home_view.php:
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>/assets/css/bootstrap.min.css"/>
If your assets folder is in the same level directory as application folder you can make a constant in constants.php(application/config/constants.php) file:
define('MY_ASSETS', 'assets/');
and your link will be:
<link rel="stylesheet" type="text/css" href="<?php echo MY_ASSETS; ?>css/bootstrap.min.css"/>

CodeIgniter: Add css link

I am trying to use the PHP Framework CodeIgniter for a PHP project. I never used it before. According to its documentation I activated the helper URL and included the css link as shown below:
$autoload['helper'] = array('url');
<link rel="stylesheet" type="text/css"
href="<?php echo base_url();?>public/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css"
href="<?php echo base_url();?>public/css/style.css"/>
Unfortunately the page is not able to load the css. Obviously if I put the compiled CSS link the page is able to load it.
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
Base_url() does not add a trailing slash. You need a forward slash in between the PHP code and public in the link href.
Say your base url is /htdocs/website/, the way you currently have it set up would print out /htdocs/websitepublic/css/style.css.
Here is the fixed code:
<link rel="stylesheet" type="text/css" href="<?php echo base_url();>/public/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();>/public/css/style.css"/>

Css file modified into temp php file in server (joomla)

I have added this below code for css reference.
JHTML::_('stylesheet', 'example.css', 'components/'._THISCOMPONENT.'/assets/css/');
It is working fine in local.But when i try to run it in the server, the css is not working due to this
output html css link
<link rel="stylesheet" href="/components/com_fms/assets/css/css-3391b7d3949af1560b9927c0c3a672b2.php" type="text/css" />
Do anyone have idea on solving this issue?
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
By default this code work correct if it is added in template-file (templates/my_fantastic_template/index.php)
Try this code:
$document =& JFactory::getDocument();
$document->addStyleSheet('components/'._THISCOMPONENT.'/assets/css/example.css');
I hope it will be helpfull.
Try using
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/system/css/system.css" type="text/css" />
instead
JHTML::_('stylesheet', 'example.css', 'components/'._THISCOMPONENT.'/assets/css/');
complet /templates/system/css/system.css with your url to the css file

Categories