Post by annadee » Wed Nov 14, 2012 4:36 am

I'm learning how opencart works. Here's my point of entry: home.tpl:

Code: Select all

<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
<h1 style="display: none;"><?php echo $heading_title; ?></h1>
<?php echo $content_bottom; ?></div>
<?php echo $footer; ?>
Its intuitive that these variables match the other .tpl files in the theme::common directory. However, where are those variables populated? How does the program know to use 'header.tpl' for $header? Likewise, in 'header.tpl' we have the line:

Code: Select all

<?php echo $currency; ?>
I can see from using the program that this echoes the currency choices, but where is $currency set? Where can I learn a list of available display variables so that I can design custom templates?
Thans,
Anna

Newbie

Posts

Joined
Mon Nov 12, 2012 9:17 am

Post by subdivide » Fri Nov 16, 2012 6:30 pm

Hey Anna,

All the major areas, and by major I mean header, footer, top, bottom, right, left _ columns are set via

Code: Select all

$this->children = array(
	'common/column_left',
	'common/column_right',
	'common/content_top',
	'common/content_bottom',
	'common/footer',
	'common/header'
);
If you look in each of your controllers ie: catalog/controller/common/home.php etc ...

You'll see the the children array. $children is a protected variable of the parent Controller and is parsed in during the render method.

See the render() method in system/engine/controller.php

I don't know how much you know about MVC or in our case with OC we're on the edge of being a full MVCL framework.

Model - View - Controller - Language

Your controllers hold your logic, your models are specifically for interacting with your database and/or external servers, your language files hold all your text, and all your design and presentation is kept within your view files.

This way everything is separate so that you can get a much finer level of control and reuse code over and over without having to duplicate your work.

Like I said I don't know if you needed that little primer, but just in case :-)

The OC framework is fairly efficient, though there's a lot of room for improvement in terms of simplifying redundant code in the controllers. We certainly need some additional classes and methods to reduce constantly writing and checking form requests, and simplifying the mapping of language variables. But, that being said, it's a very good system to learn on and it's very structured, so just hang in there and you'll get it.

If you need anything else let me know, I'm always happy to help out.

-V

User avatar
New member

Posts

Joined
Sun Jan 01, 2012 9:47 am

Post by Hison_Prenzel » Sun Dec 02, 2012 9:54 pm

Would it be possible to alter the theme by myself?

choosehottubsdirect.com


Newbie

Posts

Joined
Fri Nov 30, 2012 3:51 pm

Post by subdivide » Mon Dec 03, 2012 5:30 am

That's not really something we can answer for you.

That would depend on your skill set, if you have a good working knowledge of html, css and javascript you can certainly create your own theme. There are hundreds of themes available all across the internet.

Being that Open Cart is Open Source, it's limited only by your skill set and imagination.

If you have a more specific question, let me know and I'll try and answer it for you.

-V

User avatar
New member

Posts

Joined
Sun Jan 01, 2012 9:47 am
Who is online

Users browsing this forum: No registered users and 10 guests