calling header from a subfolder - html

I am organizing my files in the rootfolder. The basic problem is that the CSS and JS is not called. From the "page-services-3.php" I have to call the header. Because the php site is laying in a subfolder, I have tried with the following:
<?php include $_SERVER['DOCUMENT_ROOT'] . '/resources/includes/header.php' ?>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/resources/includes/footer.php' ?>
I tried with a normal href to the CSS(like the picture below) and I also set this infront of my CSS files in the header:
<link href="http://localhost:8888/Portfolio-Version-2//plugins/magnific-popup/magnific-popup.css" rel="stylesheet">
But I am just getting the following page:
How is the correct syntaxs to call a header from a subfolder? The $_SERVER['DOCUMENT_ROOT'] is working for me with the exact same folder structure in some other projects.
UPDATE
After the answer I tried to do the following:
In my page-services.php I tried the following:
<?php require"http://localhost:8888/'resources/includes/header.php'"; ?>
<body class="no-trans ">
<?php require"http://localhost:8888/'resources/includes/navbar.php'"; ?>
<?php require"http://localhost:8888/'resources/includes/banner.php'"; ?>
and i Tried to set the base in the header.php, index.php like this:
<?php define("http://localhost:8888/",dirname(dirname($_SERVER['SERVER_NAME']))); ?>
This is just resulting in the following error:
The localhost page isn’t working

try to do this in the index page
just define the website path
define("SITE_URL",dirname(dirname($_SERVER['SERVER_NAME'])));
SITE_URL : contain the 'http://localhost:8888/'
than u can call any file in the server
php file u can do
require"SITE_URL.'some_folder/some_file.php'";
or css file u can do
<link href="<?echo SITE_URL.'/some_folder/some_file.css';?> " rel="stylesheet">
for more explain how to mare php router visit php router

Related

dynamically change CSS with fat free framework?

I am trying to use some shortcodes inside my CSS so I can change them all at once with fat free variables.
For example from my config.ini:
accentColor=8f0
And in my style.css would be:
.addToCart:hover {
background-color: #[[accentColor]];
}
in my header.htm view file:
<link rel="stylesheet" href="{{#BASE}}/ui/css/style-user.php">
style-user.php:
<?php
header("Content-type: text/css; charset: UTF-8");
$fullpath='http://'.$_SERVER['SERVER_NAME'].'/ui/css/style.css';
if(file_exists('style.css')){
$search=array('[[accentColor]]','[[protectPhotoOpacity]]','[[protectPhotoPosition]]');
$replace=array('{{ #accentColor }}','0.3', '30');
echo str_replace($search,$replace,file_get_contents($fullpath));
} else {
echo "body {background-color: white;}";
}
?>
It's finding style.css fine and the other shortcode changes are working. {{ #accentColor }} is not working in the style-user.php file but works fine in header.htm. What am I missing?
Is there a better way to go about doing this?
EDIT:
I put the .php in the root folder instead of the /ui/css folder. Here's what I ended up with:
<?PHP
$f3=require('lib/base.php');
$f3->config('options.ini');
$f3->set('CACHE',TRUE);
echo Template::instance()->render('ui/css/style.css','text/css');
?>
And then inside the css file, just use the {{ #accentColor }} template variables like normal.
It's finding style.css fine and the other shortcode changes are working. {{ #accentColor }} is not working in the style-user.php file but works fine in header.htm. What am I missing?
I assume that you are using F3's templating system to render header.htm. It looks like you are not using the template system to render the CSS file.
I would propose to utilize the template system and template variables (like {{ #accentColor }}). Then you would be able to cache the parsed template files and/or the resulting CSS files for performance reasons.
Your code could look similar to the following snippet:
<?php
// Setup F3 here.
// You could utilize the routing system or skip routing and return only the CSS file.
// I would prefer the routing system with a cached route.
echo Template::instance()->render(
'style.css', // Your CSS file stored in one of the `UI` directories
'text/css',
[
'accentColor' => '#123456', // Specify variables or forward variables from a configuration file
]
);
Of course, there are other solutions. I would either register a CSS route or provide a PHP file that is bootstrapping F3 to render the CSS file with your variables.

I have css file in frontend folder but i need to apply that in my backend index.php page, how do i do this in Yii2?

I have style.css file in frontend/web/css/style.css, with same class name in backend/view/site/index.php i need to give path that css to my backend index.php.
How should i do that.
on my backend/view/site/index.php page i have place below code
use frontend\assets\AppAssets;
.
.
.
.
.
.
<?php $this->registerJsFile(Yii::$app->request->baseUrl.'/css/style.css', ['depends' => [yii\web\JqueryAsset::className()]]); ?>

Remove Top bar/header/Main Nav links from one page

I am creating a landing page and I would like to remove the topbar and header/main Nav links from this page, and this page only.
Currently, I use this CSS code to remove it:
.top-headers-wrapper{display:none;}
However, it leaves a big blank white space in place of the header. Ideally this white space would be removed and the big background image would go all the way to the top of the page.
I illustrate the difference below, where the page with -test appended to the URL has the CSS to remove the header. The original URL does not have the code to remove the header.
How can I modify the code to remove this white space as well as the header/topbar?
https://www.californiabeardco.com/summer-giveaway/
https://www.californiabeardco.com/summer-giveaway-test/
Your content-area class has a top-margin of 133px. If you are removing the header altogther then you should be able to remove the top margin like this
#page_wrapper.transparent_header .content-area {
top-margin: 0;
}
It looks like there are a couple of instances of this in the various #media queries in the CSS file. So you will have to find each instance.
Also like Obsidian mentions in the comments when I access your site I was logged in with admin privileges, you should change this as soon as possible. Hope that helps.
You should disable admin bar by more elegant way, like go to Profile > uncheck the options Show Toolbar when viewing site.
Or if you want to completely disable admin bar for all logged in users, insert this code to your theme's functions.php file.
function remove_admin_login_header() {
remove_action('wp_head', '_admin_bar_bump_cb');
}
add_action('get_header', 'remove_admin_login_header');
Another way is use filter, completely disable for all logged in users too.
add_filter( 'show_admin_bar', '__return_false' );
Ultimately, I found a solution. It's a bit of a workaround but it worked nonetheless.
The solution I found was to create a page template (e.g., "Landing Page") with no headers, footers, or sidebar. This results in a blank page which, when using a page designer like Visual Composer, allows me to design on a blank canvas, perfect for creating a landing page.
I followed the steps from this tutorial but will post them here for anyone else with the problem:
1) create a new php file
2) paste in this code
<?php
/**
* Template Name: Clean Page
* This template will only display the content you entered in the page editor
*/
?>
<html <?php language_attributes(); ?> class="no-js">
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>
<body>
<?php
while ( have_posts() ) : the_post();
the_content();
endwhile;
?>
<?php wp_footer(); ?>
</body>
</html>
3) Upload the php file to the server hosting your Wordpress instance. The location should be your theme directory. Something such as ../wp-content/themes/YourThemeName
I added the php file to my child theme which worked fine, if you use a child theme, which is usually recommended protocol as I understand it.
4) Log onto the Wordpress admin console and when you create a new page, look for your newly added Template as an option.

Wordpress - insert HTML code with different CSS

I have a wordpress site and I got an HTML for the homepage, buy when I put the the whole HTML code in Wordpress it doesn't show the page correctly
So I want that wordpress charges this page independenly of the theme CSS, how can I do that ?
Thanks !
Your theme style.css is included by default by the wordpress by wp_head() function. Before you end you HEAD tag add this function.
<?php wp_head(); ?>
If you want to add additional stylesheets then use this function in your functions.php file.
function additional_custom_styles() {
/*Enqueue The Styles*/
wp_enqueue_style( 'themename', get_template_directory_uri() . '/css/custom.css' );
}
add_action( 'wp_enqueue_scripts', 'additional_custom_styles' );

Locate and edit the main HTML file in magento store

I need to add a shadow effect png picture to the top banner in my Magento website tamween.biz, I could do this on my local server using firebug by adding a new class in the right coding area and I have made all selector properties in the bootstrap.css file.
This test was very successful, The problem is I don't know where to locate the real HTML file in the server to edit these changes?
HTML code that calls image is in root/app/design/frontend/<package>/<theme>/template/page/html/header.phtml
Image's path is stored in System => Configuration => General => Design => Header => Logo Image Src
Any skin is located in root/skin/frontend/<package>/<theme>/css
Magento HTML page is made up of blocks, and each block has a template file.
To find out where each block template file is you can add some code to the core and get rid of it after you are done.
Open app/code/core/Mage/Core/Block/Template.php:241. This should be in the method fetchView and then edit the line having the include code to the following
if (strpos($includeFilePath, realpath($this->_viewDir)) === 0 || $this->_getAllowSymlinks()) {
echo "<!-- template hint start\n";
echo $includeFilePath."\n";
echo get_class($this)."\n";
echo "-->";
include $includeFilePath;
echo "<!-- template hint end\n";
echo $includeFilePath."\n";
echo get_class($this)."\n";
echo "-->";
} else {
This will add HTML comments telling you about the template file path and what $this means in that context.
(Reference)
In magento go to System - > configuration and set template hints yes.
This way you will see each template section from where static blocks will come from.
If you have created your custom theme then go to
root/app/design/frontend//yourtheme/template/page/html/header.phtml
if not then go to
root/app/design/frontend/base/default/template/page/html/header.phtml
and the n search for
<img src="<?php echo $this->getLogoSrc() ?>">
this is the code that output the image.you can add css class to it.