Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest ConnorW

How to make new { } - {CUSTOM_BOX}

Recommended Posts

Guest ConnorW

I tried looking for an answer to this question but didn't find an answer. Any help or a link top the answer in another thread would be much appreciated.

I've customized a cart for a client, and have things where the client wants them. It has been a fun learning experience... creating new boxes (Site Links), moving the login and search into boxes, etc.

I manually added the new box through index.tpl and cart.tpl, and edited the other two. I'd like to be able to call the new box by creating a new .tpl file that gets called by {CUSTOM_BOX}. I understand how to create the new .tpl, but can't figure out how to the {CUSTOM_BOX} to call it. Maybe missing defining {CUSTOM_BOX} in another file somewhere?

BTW - Cube Cart is great. My client originally wanted Zen, which wouldn't work once installed, and then another one which wouldn't work once loaded. Finally she got Cube Cart... some days I just wish they'd listen when I suggest something in the first place.

Not a bad job considering I only started messing with Cube Cart a couple of days ago. I was able to find answers to the rest of my questions on the forums... the sign of good support forums IMO, just not this one.

The cart is at http://cart.whitewillowstitching.com/cube/ if anyone cares to take a look.

Share this post


Link to post
Share on other sites

Very nice! :cat:

Regarding your question, you need a basic understanding of how CubeCart™ PHP and XML works together. The store's PHP files send their output to XTemplates - these are the .tpl files in your skin. I'll give a brief sketch of how this works, so you can understand the use oftags like (CATEGORIES}

That tag is assigned in the index.php file in the root of your store here:

	include("includes/boxes/categories.inc.php");

	$body->assign("CATEGORIES",$box_content);



This means that the output of categories.inc.php is assigned to the index.tpl as "CATEGORIES" - so to use it you write {CATEGORIES} in global/index.tpl of the skin files.



Now, if you look at categories.inc.php, you will find that an XTemplate is the XML part of the file, and this is the .tpl file that you find in your skin's styleTemplates/boxes/categories.tpl



From categories.inc.php: 
$box_content=new XTemplate ("skins/".$config['skinDir']."/styleTemplates/boxes/categories.tpl");

And that is why when you write {CATEGORIES} in global/index.tpl you get the XML output of styleTemplates/boxes/categories.tpl

Basically, the templates you find in your skin files are produced by corresponding includes xxx.inc.php files, which fall under the broad headings of "boxes" and "content"

Hopefully this will be enough to get you pointed in the right direction :blink:

Share this post


Link to post
Share on other sites
Guest vrakas

Nice tutorial Mark, well done :blink:

Share this post


Link to post
Share on other sites

Nice tutorial Mark, well done :)

He has got a good teacher :cat: :blink:

Share this post


Link to post
Share on other sites
Guest vrakas

So do i LOL :blink:

Share this post


Link to post
Share on other sites
Guest ConnorW

Thanks for the replies.

I also found this topic, which Convict responded to, as I was looking for something else http://www.cubecart.com/site/forums/index....topic=11845&st=

I tried something really similar right after posting the question, almost worked. I think I have it all figured out now. Will have to give it a try later when I have more time.

Glad you like cart I'm working on. I want to take the site links and put them in a box to make life easier for adding it, code it once call it as many times as I want ;) Plus it makes customizing other people quicker in the future. I have another one to work on for someone else now, and maybe a third... she REALLY needs a CC.

I am very impressed at how easy it is to customize CC.

I still don't understand php or XML or CSS or Stylesheets, at least not enough to do them from scratch, but I can figure out how to change things and know enough that I can make sense of it... which is enough for what I do.

Share this post


Link to post
Share on other sites
Guest ConnorW

I'm doing something wrong. I've tried to do what was suggested but I'm not seeing the boxes. I'm missing something but not sure what it is.

In index.php I've added the following code (under // START CONTENT BOXES):

include("includes/boxes/custom1.inc.php");

$body->assign("CUSTOM_LINKS1",$box_content);





I created custom1.inc.php with the following code:




<?php

$box_content = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/boxes/custom_links1.tpl");



$box_content->parse("custom_links1");

$box_content = $box_content->text("custom_links1");

?>







I created custom_links1.tpl with the following code:




<!-- BEGIN: CUSTOM_LINKS1 -->

<div class="boxTitleLeft">Custom Links 1</div>

<div class="boxContentLeft">

	<ul>

		<li class="bullet"><a target="_blank" href="http://www.somesite.com" class="txtDefault">Some Site's Page</a></li>

		<!-- BEGIN: li -->

		<li class="bullet"><a target="_blank" href="http://www.somesite.com/forum/" class="txtDefault">Message Forums</a></li>

		<!-- END: li -->

	</ul>

</div>

<!-- END: CUSTOM_LINKS1 -->

Share this post


Link to post
Share on other sites
Guest ConnorW

Now that I have this working I found that putting {CUSTOM_LINKS1} in cart.tpi doesn't pull up the custom boxes. Small thing, but I find it perplexing.

Share this post


Link to post
Share on other sites

It's because they are assigned to global/index.tpl, not global/cart.tpl :)

Look in the store's root cart.php, just as you did in the root index.php; look under

// START CONTENT BOXES

Share this post


Link to post
Share on other sites
Guest ConnorW

It's because they are assigned to global/index.tpl, not global/cart.tpl :w00t:

Look in the store's root cart.php, just as you did in the root index.php; look under

// START CONTENT BOXES

Thanks. That makes sense... breaking up the two major chunks of CC, means a bit more work but also a lot more flexibility and ease in design in the long run. I'm not really use to things making sense. It's always nice to find something that does. :)

I'll say it again... the more I learn about CC the more I like it... and the support here is great! :D

Share this post


Link to post
Share on other sites
Guest vrakas

What support? :w00t: LOL

Welcome aboard :)

Share this post


Link to post
Share on other sites

While the wrench (for the benefit of anyone who may be a dyslexic perv, there's an "r" in that word) is being poked about in this particular area, I'm at a loss to find font where to define text colors for the regular boxes. I keep thinking it should be in either layout.css or style,css, but no joy.

See: http://winterbottomsantiques.com

The texts should mostly be FFFFFF (except for the shopping basket numbers which are red).

Advice, please?

Share this post


Link to post
Share on other sites
Guest ConnorW

While the wrench (for the benefit of anyone who may be a dyslexic perv, there's an "r" in that word) is being poked about in this particular area, I'm at a loss to find font where to define text colors for the regular boxes. I keep thinking it should be in either layout.css or style,css, but no joy.

See: http://winterbottomsantiques.com

The texts should mostly be FFFFFF (except for the shopping basket numbers which are red).

Advice, please?

For regular boxes (top is normal, bottom is hover) in style.css:

.txtDefault, a.txtDefault, a.txtLink, a.txtLocation {

	font-family: Verdana, Arial, Helvetica, sans-serif;

	color: #0E51A3;

	text-decoration:none;

}

a.txtDefault:hover, a.txtLink:hover, a.txtLocation:hover {

 	font-family: Verdana, Arial, Helvetica, sans-serif;

	color: #FF3300;

	text-decoration:none;







For the cart stuff, look a bit further down in style.css and you'll see:




.txtCart {

	font-family: Arial, Helvetica, sans-serif;

	font-size: 70%;

	color: #0E51A3;

There are a few more cart color attributes, 0E51A3 is the default blue of text so look for that and try each one until you get the colors you want. You might have to try a couple before you get the right one.

Share this post


Link to post
Share on other sites
Guest

Great posts but I have a question...

I'm trying to move {HOME_CONTENT} from the {PAGE_CONTENT} section to a side box. Creating the side box _is no problem, but I cannot for the life of me get the {HOME_CONTENT} text to show in it :)

Share this post


Link to post
Share on other sites
Guest Mohegan

Gees this is really great n all for someone who really knows what your speaking of.. when you have time could you put this in NOOBIE term.. plain english so we may do it step by step with examples

this would be super and better then anything i have seen so far .. which has still left me confused..

Thanks for your valuable posting... Phil

Very nice! :(

Regarding your question, you need a basic understanding of how CubeCartâ„¢ PHP and XML works together. The store's PHP files send their output to XTemplates - these are the .tpl files in your skin. I'll give a brief sketch of how this works, so you can understand the use oftags like (CATEGORIES}

That tag is assigned in the index.php file in the root of your store here:

	include("includes/boxes/categories.inc.php");

	$body->assign("CATEGORIES",$box_content);



This means that the output of categories.inc.php is assigned to the index.tpl as "CATEGORIES" - so to use it you write {CATEGORIES} in global/index.tpl of the skin files.



Now, if you look at categories.inc.php, you will find that an XTemplate is the XML part of the file, and this is the .tpl file that you find in your skin's styleTemplates/boxes/categories.tpl



From categories.inc.php: 
$box_content=new XTemplate ("skins/".$config['skinDir']."/styleTemplates/boxes/categories.tpl");

And that is why when you write {CATEGORIES} in global/index.tpl you get the XML output of styleTemplates/boxes/categories.tpl

Basically, the templates you find in your skin files are produced by corresponding includes xxx.inc.php files, which fall under the broad headings of "boxes" and "content"

Hopefully this will be enough to get you pointed in the right direction */*

Share this post


Link to post
Share on other sites

Mohegan, not sure what you're asking there. This is just a general explanation of how the {CATEGORIES} tag works in CubeCart's skins/xx/styleTemplates/global/index.tpl file. I have given this as an example of how tags like that work in CubeCart . . . did you open the files I mention by example, and look to find the code?

As with learning any new language, the most important thing you can do to learn is to open the files and try to read what you can in them.

Share this post


Link to post
Share on other sites
Guest advent_project

Mohegan, not sure what you're asking there. This is just a general explanation of how the {CATEGORIES} tag works in CubeCart's skins/xx/styleTemplates/global/index.tpl file. I have given this as an example of how tags like that work in CubeCart . . . did you open the files I mention by example, and look to find the code?

As with learning any new language, the most important thing you can do to learn is to open the files and try to read what you can in them.

Heres a question, where do i find the catagories.inc.php file? I need to refference and then find where i need to create my (custom_box) .inc.php file.

Share this post


Link to post
Share on other sites

the xxx.inc.php files are found in the store's includes directory . . .

includes/boxes/categories.inc.php :)

(that path is given in post #2 above, in the first CODE box :)

Share this post


Link to post
Share on other sites
Guest Tha Mad Welshman

Very nice! :D

Regarding your question, you need a basic understanding of how CubeCartâ„¢ PHP and XML works together. The store's PHP files send their output to XTemplates - these are the .tpl files in your skin. I'll give a brief sketch of how this works, so you can understand the use oftags like (CATEGORIES}

That tag is assigned in the index.php file in the root of your store here:

	include("includes/boxes/categories.inc.php");

	$body->assign("CATEGORIES",$box_content);



This means that the output of categories.inc.php is assigned to the index.tpl as "CATEGORIES" - so to use it you write {CATEGORIES} in global/index.tpl of the skin files.



Now, if you look at categories.inc.php, you will find that an XTemplate is the XML part of the file, and this is the .tpl file that you find in your skin's styleTemplates/boxes/categories.tpl



From categories.inc.php: 
$box_content=new XTemplate ("skins/".$config['skinDir']."/styleTemplates/boxes/categories.tpl");

And that is why when you write {CATEGORIES} in global/index.tpl you get the XML output of styleTemplates/boxes/categories.tpl

Basically, the templates you find in your skin files are produced by corresponding includes xxx.inc.php files, which fall under the broad headings of "boxes" and "content"

Hopefully this will be enough to get you pointed in the right direction :)

Ok, I'm not the brightest bulb in the box lol. I created "links.inc.php", "links.tpl", created the "include" in index.php //Start Content Boxes... and {LINKS} in index.tpl , I thought my ssystem might blow lol but everything stayed the same, box was not created and I get " [XTemplate]

parse: blockname [links] does not exist " where the box should be. Now I'm obviously missing something but with my little bit of knowledge I cannot see what. Please help. the site is http://www.letitblow.com

Share this post


Link to post
Share on other sites
Guest Tha Mad Welshman

post the code for your links.inc.php here

*/

if (eregi(".inc.php",$HTTP_SERVER_VARS['PHP_SELF']) || eregi(".inc.php",$_SERVER['PHP_SELF'])) {

echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>";

exit;

}

$box_content = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/boxes/links.tpl");

$box_content->parse("links");

$box_content = $box_content->text("links");

?>

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

I don't know if the first piece of code should be there, did not have it to start with but added it (copied from other .inc.php files in the same folder. But the page had the error in both cases.

Share this post


Link to post
Share on other sites

×
×
  • Create New...