GetSimple Support Forum
Custom Menu PHP Include - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Custom Menu PHP Include (/showthread.php?tid=5608)



Custom Menu PHP Include - lakaroth - 2014-02-06

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


RE: Custom Menu PHP Include - shawn_a - 2014-02-06

how are you including your css assets?
You did not provide any information for anyone to try to help you.


RE: Custom Menu PHP Include - lakaroth - 2014-02-06

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]


RE: Custom Menu PHP Include - shawn_a - 2014-02-06

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


RE: Custom Menu PHP Include - Carlos - 2014-02-06

or use absolute urls with get_theme_url:

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



RE: Custom Menu PHP Include - lakaroth - 2014-02-06

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!


RE: Custom Menu PHP Include [SOLVED] - Carlos - 2014-02-06

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'?>



RE: Custom Menu PHP Include - lakaroth - 2014-02-06

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....


RE: Custom Menu PHP Include - shawn_a - 2014-02-06

learn how to use your browser developer tools, it will tell you exactly where it is looking for assets paths.


RE: Custom Menu PHP Include - lakaroth - 2014-02-06

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


RE: Custom Menu PHP Include - datiswous - 2014-02-07

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.


RE: Custom Menu PHP Include (Solved) - lakaroth - 2014-02-14

(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: (