Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-06-2012, 05:39 PM   PM User | #1
seminaljim
New Coder

 
Join Date: Oct 2011
Posts: 13
Thanks: 6
Thanked 0 Times in 0 Posts
seminaljim is an unknown quantity at this point
Best Way to Code

Hi guys,

Im building a site from scratch and Im doing it with only me and my friend so far. When i started I was told to learn HTML and CSS first, which i did and then moved onto PHP, some javascript, and then messed around with joomla to understand how CMS worked.
I have a pretty good idea of how coding works as i did COBOL and PASCAL in college, and some C++ on my own.
The thing is that when I looked in some of the Joomla php files I can see that it is coded completly different to what ive seen on tutorials on the web. Id like to know if there is a definete best way to code, and where i could find out the best way to build a site from scratch without creating the site then having to scrap all the code ive worked on in the future to replace it with better coding conventions. As it would save alot of time, I like jumping in the deep end. :-)

Cheers. Jim.

PS. If you look inside the joomla index.php file youll know what i mean...

PHP Code:
<?php

// Set flag that this is a parent file.
define('_JEXEC'1);
define('DS'DIRECTORY_SEPARATOR);

if (
file_exists(dirname(__FILE__) . '/defines.php')) {
    include_once 
dirname(__FILE__) . '/defines.php';
}

if (!
defined('_JDEFINES')) {
    
define('JPATH_BASE'dirname(__FILE__));
    require_once 
JPATH_BASE.'/includes/defines.php';
}

require_once 
JPATH_BASE.'/includes/framework.php';

// Mark afterLoad in the profiler.
JDEBUG $_PROFILER->mark('afterLoad') : null;

// Instantiate the application.
$app JFactory::getApplication('site');

// Initialise the application.
$app->initialise();

// Mark afterIntialise in the profiler.
JDEBUG $_PROFILER->mark('afterInitialise') : null;

// Route the application.
$app->route();

// Mark afterRoute in the profiler.
JDEBUG $_PROFILER->mark('afterRoute') : null;

// Dispatch the application.
$app->dispatch();

// Mark afterDispatch in the profiler.
JDEBUG $_PROFILER->mark('afterDispatch') : null;

// Render the application.
$app->render();

// Mark afterRender in the profiler.
JDEBUG $_PROFILER->mark('afterRender') : null;

// Return the response.
echo $app;
seminaljim is offline   Reply With Quote
Old 04-06-2012, 11:20 PM   PM User | #2
M.Jackson
Regular Coder

 
Join Date: Aug 2011
Posts: 120
Thanks: 1
Thanked 15 Times in 15 Posts
M.Jackson is an unknown quantity at this point
Well, no I don't know what you mean.

It's just like any application that you look at in that it is divided into multiple levels of abstraction. True, that you cannot tell what is going on just by looking at one file of php any more than you can tell how a C++ program works by reading main(). Programing simply is not that transparent.

The real work of that file you posted is in 'framework.php' and its included files. If you understand the programming language at all, then you just keep going deeper in the includes until you get to some code that you understand. Then you've hit the lowest level of abstraction of the application in question. Everything else should simply call those functions in some sequence that will only make sense when you know what each one of them do.
M.Jackson is offline   Reply With Quote
Old 04-07-2012, 12:33 AM   PM User | #3
akonlaura
New to the CF scene

 
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
akonlaura is an unknown quantity at this point
i don't understand what you are saying because i m well known of this code but in your way of describe i never understand.




fort st john
akonlaura is offline   Reply With Quote
Old 04-07-2012, 12:40 AM   PM User | #4
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,532
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Cobol and Pascal are procedural programming languages.

PHP is an object oriented language.

There are huge differences between these two types of languages.

Being familiar with a dozen or more procedural languages it still took me a couple of years to work out how object oriented really works.

Presumably if you don't understand this difference the C++ you wrote was actually C rather than C++ as C is a procedural language and C++ adds the extra constructs needed to make it object oriented.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Users who have thanked felgall for this post:
seminaljim (04-07-2012)
Old 04-07-2012, 01:02 AM   PM User | #5
seminaljim
New Coder

 
Join Date: Oct 2011
Posts: 13
Thanks: 6
Thanked 0 Times in 0 Posts
seminaljim is an unknown quantity at this point
Thanks akonlaura, i think i need to work on the object-orientated stuff. Do you know where is a good source of information on the OOP side of things.

And Jackson, I know that there is multiple levels of abstraction! I understand how includes work.

I was hoping that someone could point my in the direction of a source to learn the best tips and techniques of creating a site from scratch in the same way.
seminaljim is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:58 PM.


Advertisement
Log in to turn off these ads.