Actions

J1.5 talk

Difference between revisions of "Developing a MVC Component/Introduction"

From Joomla! Documentation

(Tutorial articles detected ...: new section)
Line 1: Line 1:
 +
== Typo on page? ==
 +
Hi, new to this, so hope this is the right place.
 +
 +
I'm working through the example.
 +
 +
I notice that the code for 'hello.php' has the line:
 +
 +
if($controller = JRequest::getWord('controller')) {
 +
 +
Whereas the accompanying text uses
 +
 +
JRequest::getVar('controller')
 +
 +
It seems to me that the getVar function makes more sense so should the code for hello.php be changed?
 +
 +
 +
== Question on fonts ==
 +
 
is there anyway to make the font for ".source-php .kw1" a more printer friendly color yet still be distinguishable as important text?  At the very least lets make the font "bold" so it is stronger in contrast.  Even in the highest quality setting on printer it appears very washed out to these old eyes.
 
is there anyway to make the font for ".source-php .kw1" a more printer friendly color yet still be distinguishable as important text?  At the very least lets make the font "bold" so it is stronger in contrast.  Even in the highest quality setting on printer it appears very washed out to these old eyes.
  

Revision as of 08:23, 23 August 2009

Contents

Typo on page?

Hi, new to this, so hope this is the right place.

I'm working through the example.

I notice that the code for 'hello.php' has the line:

if($controller = JRequest::getWord('controller')) {

Whereas the accompanying text uses

JRequest::getVar('controller')

It seems to me that the getVar function makes more sense so should the code for hello.php be changed?


Question on fonts

is there anyway to make the font for ".source-php .kw1" a more printer friendly color yet still be distinguishable as important text? At the very least lets make the font "bold" so it is stronger in contrast. Even in the highest quality setting on printer it appears very washed out to these old eyes.

You can add your own stylesheet to override any of the system-generated styles by adding a special subpage under your user page. In your case, create the page User:N6REJ/monobook.css and add your CSS rules into it. Chris Davenport 08:55, 19 January 2009 (UTC)

Use lowercase file and folder names in your components!

When creating custom components try to use file names and folder names with all lowercase letters. I had created some complex MVC components, naming my folders and files after my classes in the component. This meant that I had upper and lowercase letters in the folder and file names. During testing on my Windows machine everything worked fine, but when I transfered to a remote host running unix, nothing worked properly. The errors provided by the framework were only slightly helpful in identifying the root cause which was that the JPath:: class implicitly calls strtolower() on all paths. Therefore my files were not being found by the framework. I hope this helps save someone some time.

View naming conventions

It should probably be mentioned that the naming of the "view" script is strictly as named here; Joomla looks for "view.html.php" for the class to render HTML, and "view.feed.php" for a feed display, etc. I at first omitted the ".html" double extension from my file, and quickly ran into errors, so it might be best to mention that, the same way the entry point file name has to match the component name. --MidnightLightning 16:35, 6 April 2009 (UTC)

Tutorial articles detected ...

Double tutorial detected, older but somehow different (especially Part 4) Tutorial:Developing_a_Model-View-Controller_Component_-_Part_1. these Tutorial pages are all marked now as double but a manual merge might be needed.