![]() |
new/custom php page?
Hi there.
I have bought a new search program, and need to modify a search page. I'd like to insert some php code into it, but search.php has a lot of code and calls and programming logic that I can't seem to understand (I have tried deleting code line by line, but always get some kind of error). Is there some basic layout for a php page (that I can get a code snippet) that is basically a blank page and will allow me to put standard php code into? For that matter, is there a way to have a custom php page that has the template with "hello there" even on it in regular php, not calling a tpl page? Thanks a bunch!!! |
Re: new/custom php page?
Here is an example taken from
http://www.w3schools.com/PHP/DEfaULT.asP <html> <body> <?php echo "hello there"; ?> </body> </html> To get your content to be "surrounded" by your cart's design however you will need to create a template ("myphp.tpl")and include it by putting {include file="myphp.tpl"} in x-cart wherever you want your content to be displayed. Its not quite as simple as that but, not really much more difficult either. You may or may not need the "html" and/or "body" tags depending on where you place it in x-cart. Example: name the following myphp.tpl and save it to the root directory of x-cart Code:
<?php |
Re: new/custom php page?
Thanks a million J!
I'd like the page to sit alone though - not be a template that's included within the home page - just like either the cart.php, search.php, news.php, or any of the other php pages that only have one type of content in them. If I did this correctly, it shows on the main template on each page, not when I call xcart/mypage.php right? Thanks again! |
Re: new/custom php page?
A lot depends on how you want to access it. You could just make a static page and include a link in the speed bar. That will put your content in the "center" area of your cart (similar to your FAQ page).
Your php will probably need some of the "includes" that are used by x-cart. Look at just about any php script x-cart uses (they are near the top... (require "./auth.php"; require "./security.php"; whatever ones seem necessary). |
Re: new/custom php page?
It sounds like you are working on a "search" module, but you didn't specify if it was for the customer or admin. Anyway, what if you used the present link ("advanced search") and linked it to your new "my_search.tpl and my_search.php" using the existing search template and search.php and cloned them, putting in your own code.
I would be interested to see what you come up with. |
Re: new/custom php page?
Yep - I am trying to put together a new search module for my site. I've tried to dissect the search.php page. I've commented out just about everything to just a bare-bones page, but when I do that I get a "page not found" error.
I guess what I'm looking for is how to build a basic php page...what elements have to go in it, and where they have to be. I've gleaned from these forums that I need a php page with an include to a tpl file? my search.php is this: Code:
<?php I flushed my templates, but just for a test my tpl file: Code:
{* $Id: mysearch.tpl *} Where am I screwing up? |
Re: new/custom php page?
I've tried to use balinor's post here, but it doesn't explain how tpl's interact with php pages and vice-versa.
Thanks again! |
Re: new/custom php page?
Umm.. try looking at skin1/customer/search.tpl.
Note that it has some "search" parameters and then at the bottom of the code (after the button) it has Code:
<a href="search.php"><u>{$lng.lbl_advanced_search}</u></a> Code:
echo "hello there"; |
Re: new/custom php page?
I'm no wiz at php but I think the
require $xcart_dir."/skin1/mysearch.tpl"; is wrong. There should be a include skin1/search.tpl that calls mysearch.php, not the other way around (I think). A .tpl is pretty much html, and html can include php, but I'm not sure about the other way around. I know php can include html code, that can be displayed, but I'm not sure that entire .tpls can be used. |
Re: new/custom php page?
Quote:
If you want this page displayed on customers side in skin1/cusotmer/home_main.tpl you have to specify which template to load when your new.php is called {if $main eq "_mysearch_"} {include file="path_to_file/mysearch.tpl"} {/if} Just look at the if statement there you will get the idea |
All times are GMT -8. The time now is 02:08 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.