I'm working with Magento. See the following code:
<?php echo $this->getChildHtml('topMenu') ?>
Is there an easy way to find where HTML resides. I.e. is there some kind of trace I can use?
In the admin go to System > Configuration > Developer, pick a store from the "Configuration Scope" select in the top left corner, then there will be a new option in "Debug" section called "Template Path Hints". Turn this on and refresh your store page again.
This and more is explained in the Designer's Guide to Magento.
I fully agree with the answer of clockworkgeek - the easiest way is to turn on Template Path Hints in System -> Configuration -> Developer section of admin panel (scope of your store must be chosen for this field to appear). After that all your store pages will be rendered with inclusions of red panels, showing the path to templates.
Nice addition is also to turn on Add Block Names to Hints in the mentioned above admin section - so you'll also see block names serving that templates.
These actions will allow you to easily trace 95% of all design.
However, there are also some blocks that do not render phtml. Or they overload standard toHtml() method in such a way that it doesn't show template's path. These are more complicated cases. To find the place where design is created you should either:
Learn layout-blocks-phtml model of View part in Magento - Designer's Guide to Magento is a good place to study it. Then you'll be able to find blocks and templates by layout structure.
Install X-Debug, set it up for your IDE, set a breakpoint at <?php echo $this->getChildHtml('topMenu') ?> line and dig in this line. It's the easiest and most universal way to solve your problem (although knowledge of Magento design structure still is a must).
Related
I have been going insane trying to figure out how to modify the WET-BOEW distribution of Drupal 7 and have been met with little to no results.
http://drupalwxt.github.io/
I do not have a lot of experience with drupal. I used it many years ago and I hated it as much then as I do now; unfortunately, employment requirements have forced me to dig into it again.
How do I go about modifying the theme? Even just modifying the header would be a massive step in the right direction.
For the record, the files I am modifying are in /profiles/wetkit/themes/wetkit_bootstrap/templates
Modifying system/page.tpl.php has no effect
Modifying system/html.tpl.php has an effect, unfortunately I am met with $page_top, etc and no actual markup for the header.
I am completely and utterly lost.
EDIT 1
I have created a folder under /sites/all/themes called "playground". In this file, I have added my basic info and copied the regions from the original wetkit info file.
I created the structure for <theme>/templates/system and added an html.tpl.php file containing a die() to test if it is overriding the base theme...it does not appear to be.
I make a point of clearing the cache after every change.
EDIT 2 (Solution)
It turns out that I was trying to modify the wrong file all along. For the WET-BOEW Drupal 7 distribution, changing the markup is done through <theme>/templates/panels/page--panels--wet-boew.tpl.php and by adding a custom CSS file to theme_name.info.
I'm sure this is all elementary stuff, but I've been struggling with it for a while now. Thanks for the help.
First, go to appearance page (url: /admin/appearance) and see what theme is used. Maybe you are changing wrong theme.
Then, check if page caching is on on performance page (/admin/config/development/performance). If so, you may need to clear the cache after every change with "Clear all caches" button on same page.
Oh and those system template files are usually overwritten with custom theme files. So don't change them.
Again, theme template files are usually placed in directory:
/sites/all/themes/theme_name/templates
starting from website root, so look for the files there or on some similar location if you have some specific site settings (multisite or something).
I am a beginner with Magento trying to build a simple custom theme and while I have done a fair bit of research I am really in need of some simple clarifications because I think that the learning curve is rather steep but worth it once some basic concepts are understood. My design goals are very basic: All products listed on the homepage with different image sizes, floating left.
What I've done is downloaded the 'Modern' theme as a base to work with and renamed it:
app/design/frontend/default/mytheme
skin/frontend/default/mytheme
I've done some basic tweaking to the phtml files in
app/design/frontend/default/mytheme/template/
However, I have a number of questions:
Where exactly is the template for the homepage? Is it only customizable using the CMS>Pages control in the backend under Design>Page Layout? This confuses me because I am used to developing in wordpress and creating a custom php file for the index/homepage. I really think this separation of html/xml is really the hard thing for me to grasp.
If i can only customize the homepage using the backend, I see the block: <block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page">. Navigating to mytheme directory, I don't see anything referring to this. Where are these things located? Am I supposed to copy any file missing from mytheme from the base?
Is it only possible to have 1 column, 2 column, 3 column etc. layouts?
An endless thanks to anyone who can steer me in the right direction. I really think it is just a matter of understanding very important fundamentals of how Magento themes are structured. At the moment I am already finding it so frustrating having my finder window open 7 folders deep and having to move around constantly. How I miss the simplicity of Wordpress' single folder themes.
Thank you!!
I suggest you to read all things in http://www.magentocommerce.com/knowledge-base before you go further
homepage content can be anything you want and you can reference it to be anything with layout file descriptors
MVC concept tells that it is taken from catalog/product_new block and from whatever is set to it's template. In current case catalog/product/new.phtml is used and you can edit this
you can have a completely custom setup and not restricted to anything that default contains. However it is wise to use defaults as almost all extensions depend on defaults more or less.
A very big part of magento design is layouts.
whether you choose to use a local.xml or change files from layouts folder you must have an ideea on how they work.
Here is a link for start
Intro to Layouts
There are many others resources outhere ofcourse.
In the Joomla back-end, the administrator would do modifications using the GUI.
Say a module is enabled(just click the check box).
What happens in php-level?(what happens to the code?)
Some trivial assumptions I come up with are,
-commenting/uncommenting
-some code snippets are added/removed
-configuration(ex: xml) files are modified/created
Joomla itself doesn't really modify files on disk much at all. The only exceptions I can think of are:
Installing an extension (writes to '/tmp', and then the final location for the extension files)
Saving global configuration options (writes to '/configuration.php')
Caching (writes to '/cache')
All other configuration changes, entered data, etc from the admin area (and frontend) are stored in the Joomla database.
So the example given (enabling/disabling a module) doesn't edit or create any files. It only makes changes in a core database table (jos_modules, if your DB prefix is 'jos_'). Module inclusion on all pages is dynamically evaluated per page-load based on the code in your template, as #Hanny mentions.
If you read the index.php file in of the template you're using - you'll find that all the positions of the template are included in that file <jdoc include="position10" /> or something of that nature is what it will say.
Usually the templates use CSS to help determine how to 'shape' the page depending on which modules are enabled, along with 'if,then,else' statements on the php level. Read through the index.php file and you'll probably see that.
if "module10" then use "rightmodule.css" type thing - which then may hold changes to be made to certain containing div's with regards to width and that sort of thing.
No commenting/uncommenting happens, no code snippets are added and no configuration files are modified/created (at least as far as I know, and I've worked to design a component for Joomla previously). It's all if statements and tying that together with the module positions that are laid out in the templates index.php file.
This is a simplified answer, but I think it answers what you've asked.
I am making a site with Joomla mainly because of the user levels. Now hands on into development enough that I cannot back out, I've realized that Joomla's theming is not as awesome as WordPress'.
When I started making the Joomla theme I realized there is no single.php like separate template for displaying article pages. But I want that when I click on an article link the page layout is wider so that the full article is more readable, basically I wanna hide the sidebar and make the article column wider when viewing a single article.
The biggest problem is that I have finished the HTML & CSS pre Joomla or any CMS jump with all the HTML5 tags and what not. I figured there would be template tags like WordPress or something similar that would give me complete control of my HTML but with Joomla everything just gets rendered as complete components with HTML and CSS all set in. It was such a pain when the pagination just rendered as a list when all I wanted was 2 links of previous page and next page. Am I doing something wrong or is Joomla just built this way.
If I start changing the components and modules the way I want, will they be changed back to defaults when I update the core. I read somewhere from 1.7 Joomla has integrated 1 click upgrades.
I sincerely hope I'm just wrong.
Sorry for jamming three questions in one but I think my title is quite explanatory so anyone looking for similar things would understand.
Thanks! I appreciate all the help.
and welcome to Joomla. Because your question(s) are long so will your answer so hold still...
First of all just to clear it up, the Joomla templating is a proper templating engine where as Wordpress is not (it's not even a CMS - check their website), this is often construed as poor coding rather than best practice as it's more of a steep learning curve.
1) I wanna hide the sidebar and make the article column wider when viewing a single article.
This can be done through conditional assignment within your template, if around your RH column in your template you can place this if statement:
if (JRequest::getString('option') != 'com_content' && JRequest::getString('view') != 'article') { echo '<div id="myRightHandColumn"><jdoc:include type="modules" name="right" style="xhtml" /></div>'; }
You will also need to apply this code to add a class to your wrapper around your main content to tell your CSS to make it wide.
2) give me complete control of my HTML but with Joomla everything just gets rendered as complete components with HTML and CSS all set in
That's not entirely true, all WELL made extensions have a views folder containing overridable html output. For example if you wished different HTML to be outputted for the article view from com_content you would copy this file:
/components/com_content/views/article/tmpl/default.php
and place it in your template like so:
/templates/your_template_name/html/com_content/article/default.php
3) If I start changing the components and modules the way I want, will they be changed back to defaults when I update the core.
Assuming you follow my instructions and use overrides rather than core-hacks then you will not lose changes when upgrading the core. Naturally you should never upgrade in a production environment.
If any parts are unclear just drop a comment and I will help as best I can.
You are definitely doing it wrong, Joomla's templating system is far more advanced and flexible than WP. You need to read up on the template override system and how to use collapsible module positions. The official documentation is still 1.5 focused, but it's pretty much the same thing as far as overrides and modules are concerned.
Overrides - http://docs.joomla.org/Understanding_Output_Overrides
Collapsing columns - http://docs.joomla.org/Collapsing_columns
All template docs - http://docs.joomla.org/Template_Development
You should also look in to the new template style options.
I'm new to Drupal, and frankly after reading through the Drupal documentation, their guide to themeing isn't all that helpful. Maybe I'm just misunderstanding, but it seems like there are certain variables you always have access to and different functions you can define to override or implement behavior.
Long story short, I'd like to be able to trace through the Drual themeing code to understand hwo it works. Doesn't seem like it should be all that difficult, but I'm having a hard time finding a good reference. Anyone know of one?
http://www.nerdliness.com/article/2007/09/10/drupal-theming
There are a few different resources you can use that might help out:
You can use the irc channel on freenode: #drupal-themes
A module that I hear a lot of themers like is the Devel module - http://drupal.org/project/devel. This is what will allow you to trace through the code and see what variables, function calls, etc. are being used.
You might also want to check out the Druapl 6 Themes book
I'd recommend Front End Drupal: Designing, Theming, Scripting over the Drupal 6 Themes book. I put together a Drupal 6 Theming Cheat Sheet that includes links to the resources I've found most helpful.
Honestly, though there are good links and books to learn from, the way I've learned quickest was to start creating a theme. Create your theme.info file, then begin converting an index.html to page.tpl.php or page-front.tpl.php using the snippets in the cheat sheet or the nerliness.com link mentioned in Robert Harvey's answer. Those two files constitute a bare-bones theme.
From there, you can override additional template files as needed. You can use the Theme developer to find just what templates to override, to customize a particular part of the site. Remember to clear the theme cache, as you add new template files.
Also, make sure your theme has the base template of any file you want to override. See the "Note: There is a bug which prevents derivative template files from being detected..." section of the Core templates and suggestions page, for more details.