X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Calling an HTML Scroll Bar, NEED php help (https://forum.x-cart.com/showthread.php?t=3906)

lyle 08-06-2003 08:51 PM

Calling an HTML Scroll Bar, NEED php help
 
This is INSIDE my MAIN home.php

<IFRAME width="460" height="395" frameborder="yes" scrolling="auto" name="iframe" SRC="insert.php"></IFRAME>


now insert php has the call :
{include file="customer/home_main.tpl"}

this ISNT displaying, all I get is just the text inside the scrollbox...

HOW can I make a call to the template from this text/html box???

Ive been messing with this for far too long
thanks!

kpayne 08-07-2003 03:04 AM

Can you post the code for insert.php and / or a link to the site in question?

lyle 08-07-2003 06:45 AM

hey thanks :)
well the insert.php really has nothing, {include file="customer/home_main.tpl"} is the main part of it... the site is www.hempgirlz.com/xcart/customer/home.php

thing is im not sure what shape that page will be in Im making all kinds of changes etc

it *should* be there though and the reason I need the scroll bar is obvious when you get there I need all the items and functions to fit in my graphically driven site
ty!!!

kpayne 08-07-2003 07:30 AM

Well, "insert.php" is a php script, not a smarty template. You're trying to use smarty syntax outside of a smarty script.

Read up on the forums about smarty and you should be able to figure it out. If not, you can always post questions.

It's actually somewhat complex to get a new page with smarty to work like you're wanting it to. I, personally, would suggest finding a better solution, or posting in the smarty area of the forum exactly what look / functionality you're going for and seeing if anyone else has some examples.

I hope this helps!

lyle 08-07-2003 08:53 AM

kk
thanks and before i go too far into the depths of smarty stuff (really gotta get this site up ;)

does this hold any water? am i on the right path at all with this post?
__________________________________________________ ______
AJ
Member



Joined: 17 Oct 2002
Posts: 25
Location: Marietta, Ohio
Posted: Fri Nov 22, 2002 11:35 am Post subject:

--------------------------------------------------------------------------------

Since I haven't seen anyone post a solution on this, I'll post a couple methods I'm using.

To include a php file in a Smarty .tpl file, just do this:

{include_php file="/pathtofile/file.php"}

This seems to work pretty well, assuming you don't need to use any variables from Smarty.

You can also use actual PHP code too! Just do it like this:

{php}
php code goes here;
{/php}

For this to work, you have to set the $php_handling variable to SMARTY_PHP_ALLOW in /Smarty-2.1.1/Smarty.class.php.

Hope that helps someone out there. Took me forever to figure it out. Now, if someone can tell me how to pass a Smarty-defined variable to an included PHP script, I'd love to hear it!

lyle 08-07-2003 09:54 AM

all im really trying to do is pull
customer/home_main.tpl into a scrollable document within my actual page

how is this best accomplished?
thanks ;)

slimmedia 08-07-2003 09:47 PM

You're on the right track but you were trying to cut out too many steps.

Your IFRAME is calling "insert.php". So what you need to do is take most of the code from /customer/home.php and paste it into "insert.php". Then include a different smarty template instead of "customer/home.tpl".

Based on x-cart version 3.4.4, insert.php would look like this:
Code:

require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";

require "../include/categories.php";

if (!empty($cat))
        require "./products.php";

require "./featured_products.php";

if($active_modules["Bestsellers"])
        include "../modules/Bestsellers/bestsellers.php";

if(!empty($current_category)) $location = $category_location;
#
# Assign Smarty variables and show template
#

$smarty->assign("main","catalog");
$smarty->assign("location",$location);
$smarty->display("customer/just_the_middle.tpl");


Note that the last line is all I changed.

Then you need to setup a special template for this purpose. I've named it "just_the_middle.tpl" and put it in the "customer" directory. I took the code from "customer/home.tpl" and cut out all the stuff you don't want. Here's the code of "just_the_middle.tpl" (once again, this is based on version 3.4.4).

Code:

{ config_load file="$skin_config" }
<html>
<head>
<title>Some title</title>
{ include file="meta.tpl" }
<link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}">
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
{include file="customer/home_main.tpl"}
</body>
</html>


I haven't tested it, but that ought to do it. Good luck.

lyle 08-08-2003 06:48 AM

hey thanks a lot was gettin discouraged bigtime
I appreciate your time and now im gonna go try this! :lol:

_____________________


Worked like a charm took me 30 seconds to make this work after spending about 8 hours on it!

thanks again

lyle 08-08-2003 07:07 AM

i guess now some crafty href calls as all my links are reopening in that small IFRAME window
hmm new cans of worms at every corner...

I like learning, and I sure didnt know jack about this last week ... ;)

slimmedia 08-08-2003 07:20 AM

If you're going to do your whole site inside an IFRAME it may be easier just to have your IFRAME call /customer/home.php and then save the "just_the_middle.tpl" as "/customer/home.tpl".


All times are GMT -8. The time now is 01:57 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.