GetSimple Support Forum

Full Version: Custom Menu PHP Include
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there, i'v made a custom menu with jquery and etc etc
I want use it instead the normal menù, so i think to use include PHP code like this:
PHP Code:
<?php include(GSTHEMESPATH.$TEMPLATE.'/filename.php'); ?>
or
PHP Code:
<? include("filename.php"); ?>

In any case,the page is included without CSS and does not work...
I have also tried to include CSS and others thing in template.php just copy and past the same code in my external menu but dont work... what i need to do?
Thank you
how are you including your css assets?
You did not provide any information for anyone to try to help you.
I'm sorry you right, but but i'm not expert, i really dont understand how to explain i try like this.

I have template.php file in theme folder, i have try to write in that file just before website content the code:
PHP Code:
<? include("filename.php"); ?>
or
PHP Code:
<?php include(GSTHEMESPATH.$TEMPLATE.'/filename.php'); ?>
I think is the same... anyway.

The result is this, my external menù appear wothout his css and others thing who let it work, is just a normal HTML text.

I dont know where to call CSS becaouse the CSS file are called in his own file (externalmenu.php) and if i try it alone it works.

If i try to call again in template.php file the css style like this:

PHP Code:
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<
link href="css/common.css" rel="stylesheet" type="text/css" />
<
link href="css/facets3.css" rel="stylesheet" type="text/css" />
<
link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
<
link href="css/menu.css" rel="stylesheet" type="text/css" />
<
script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/jquery.clip.js"></script>
<script type="text/javascript" src="js/jquery.facets.js"></script>
<script type="text/javascript"> 

Then:

PHP Code:
<? include("filename.php"); ?>

Dont work...
Where i need to call CSS and others JS file to have a result like this?
[Image: fnn8.jpg]
ok you are using relative urls for your assets, when you include this file the path changes to the source file.
so you need to change the asset locations relative to the main file not the included script.
so if they are in a subdirectory add the sudirectory or perhaps a slash /css
or use absolute urls with get_theme_url:

PHP Code:
<link href="<?php get_theme_url(); ?>/css/reset.css" rel="stylesheet" type="text/css" />
... 
I understand.... problem solved.

I use the wrong command:

PHP Code:
<? include("directory/filename.php"); ?>
instead of:
PHP Code:
<? include("filename.php"); ?>
And change path...

So i understand this command work only the files are in the same folder, or well... the command include dont support folder/filename.php but only filename.php it's correct?
Thanks a lot!
This one you posted (well, similar) should work fine:
PHP Code:
<?php include GSTHEMESPATH.$TEMPLATE.'/filename.php'?>

[edit] This one should also work:
PHP Code:
<?php include 'filename.php'?>
i got crazy... is not solved i dont understand why guys... i'm tired now, i'll update the post with more info tomorrow.. it's late here, thanks for now....
learn how to use your browser developer tools, it will tell you exactly where it is looking for assets paths.
Yeah i know a little bit how to use developer tool, i know a little bit HMTL and CSS i need a developer for my buisness i also have post in off topic.... because i'm a designer not a developer Smile
I'm glad for all of your answer guys and i say thanks to all of you for your time.

But untill i find a developer who work with me i need to do alone my stuff...

Maybe is better if i try to explain wich result i want for this project.

In this website it works like i want.
http://www.getsimplethemes.com/ (Main website)
http://www.getsimplethemes.com/demos?theme=cleansmart (Live demo)

As you can see, the live demo page is divide by on the top (Nav Bar) on the content (Live demo)
I need to do the same thing, because in my website must be live demo too, also i prefer use a complex jquery menu instead the standard menù.
So i can use only the CMS features for change contents.... and have a cool menù.

I realize trying this, maybe is more easy that i think.... but i have a lot of CSS conflict with the simple command "php include"

Best regards
Maybe you can try to study templates who do php include with other template files. Like Innovation theme and GStwentytwelve.

I assume you try to include the menu (from an other template file) into the main template file. You can also take the menu as basis and include a template for every demo-site you want to show.

So your page consists of 2 template files: top (menu) and rest. Top stays the same (or you want a different styled menu somewhere else..). Rest consists of one website template and multiple "demo" templates.
(2014-02-07, 11:25:27)datiswous Wrote: [ -> ]Maybe you can try to study templates who do php include with other template files. Like Innovation theme and GStwentytwelve.

I assume you try to include the menu (from an other template file) into the main template file. You can also take the menu as basis and include a template for every demo-site you want to show.

So your page consists of 2 template files: top (menu) and rest. Top stays the same (or you want a different styled menu somewhere else..). Rest consists of one website template and multiple "demo" templates.
.
ok I admit, sometimes I pretend to learn things without studying are very lazy ... I finally figured out where wrong studying other templates are able to understand and incorporate what I wanted.
The problem was the following:
The file that I wanted to include was a renamed html to PHP so all the paths were poorly written and did not work.
If I learn how to enable mod_rewrite are in place ...
PS: I'm really mad I follow the wiki but there is no way to make it work, it gives me error page not found: (