Stats: 3,186,500 members, 7,929,633 topics. Date: Friday, 23 August 2024 at 06:20 PM |
Nairaland Forum / Science/Technology / Webmasters / Moving To Oop Javascript/php Class Module Creation & Instantiation (5173 Views)
Pls Help Me Convert Ths Code To OOP / Form Validation Tutorial Using Javascript, Php, Ajax / Form Validation Tutorial Using Javascript, Php And Ajax! (2) (3) (4)
Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 7:28am On Jan 04, 2009 |
Yo Guys, this thread is for all the php and javascript guys in the house. On this thread, I am going to assume that you can already write some javascript and you are a regular coder. Now, my favorite IDE happen to be Notepad ++ and I am very fast with it because stuffs i create or download in php and ajax, once i find them useful, i convert them to reusable codes - so i am going to be discussing those techniques in here. As way of introduction, PHP is an Object-Oriented Language, But Javascript is not an OOP lang but it is composed of objects - i can't explain this here [out of focus] - but let's go on. First What Are Classes? These are modules that run in a separate memory space - they have their own internal memory, functions, and they don't class with each other - for instance i can say: Virtual.php
Do not bother to run this demo - i am just tryin to show you what classes are about. Now i declared a class up in the script. Then i now went on to create 2 copies (called instances) of the same class - one for google and one for nairaland. Then i proceeded to call a function (called method) in the class to visit the urls. So the $naira variable creates a copy of the class in itself and keeps it inside itself, and same for the $google variable. Later on in this thread - i am going to be featuring some of the classes i have in both javascript and php. Meanwhile questions are expected and will be answered as appropriately as possible. And remember, creation and usage of reasonable classes is one of the highest levels of programming - I stand to be corrected on this one. All top-programmers can create classes as far as I know - i am yet to meet one that cannot. However some languages like JAVA and C necessitate class creation even for beginners. But in javascript/php you can still write great codes without classes but your codes will be soooo looong and you will have problems with repeating them when u have another job to do. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 7:35am On Jan 04, 2009 |
If you are interested in this, please signify by posting something like "yo man - let's get it started". Lemme see the response of ppl before posting any codes here, waiting, and happy new year. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by OmniPotens(m): 3:00pm On Jan 04, 2009 |
More interesting things for programmers this year. This is no longer the time where everyone is waiting for website review. Now, it is practical. Thanks brother. You are doing too well. Keep it up! |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 5:59pm On Jan 04, 2009 |
yo man |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 7:32pm On Jan 04, 2009 |
Step 2: We are going to create an ajax class that dynamically loads pages on your sites. But before then let's take a small look at how to actually use ajax to load stuffs - that way u will easily see the power of that class. I paused at this point to create an ajax thread https://www.nairaland.com/nigeria/topic-214605.0.html#msg3303246 so u can learn the basics of ajax right there if you dont know it already - then u can continue reading on from here. There was a demo i featured on that thread - i am now going to use something similar here. You can download the files of that ajax_starter featured on that thread. I am going to modify the index.html by converting those ajax functions into a class definition. In case you havent downloaded the original ajax_start files, u will find them here http://www.mwebng.net/?net=dl
I only changed the former one by encapsulating the download function into a class. And this will take us to the next level. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 2:58pm On Jan 05, 2009 |
I have to wait for students to show up before continuing this class otherwise i am done. If you are interested in the continuation of this thread, just say so, or at least post "OOPS!" on this thread - actually all i need is at least one student to continue - as for the rest of the defaulting students - God help them! At least Baba God no go tell me say i no try! |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by abevolve: 1:17pm On Mar 08, 2010 |
Good day, Mr Webmaster. Please i' a baby wed designer and would want to learn the basics of javascript and flash. I got my hands on dreamweaver and fireworks but flash and java are no man's land for me please help keep the flag flying |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 1:41pm On Mar 08, 2010 |
Nice of DHTML. Have to go off nland. But i go still learn from DHTML ohhh. at least sniff through the tutorial and get the best from it. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 7:35am On Mar 09, 2010 |
ab_evolve:please contact me thru email - support@.com Donpuzo:these were in my younger dayz when i still have loads of times to play with, these dayz, 24hrs do not seem to be enough! but we will still keep tryin to do the best we can. thanks |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 9:07am On Mar 09, 2010 |
Still i get OOP in PHP,C++ and Java but the OOP System in Javascript Eludes me i mean Prototype maybe am too lazy to go further will bring that up.also is it to late to say "YO MAN". |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 12:07pm On Mar 09, 2010 |
hmmm. Since you were this good last year. That mean 1 yer interval you don turn Donpuzo abi Donparrazinno for coding. No shit man. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by cdeveloper(m): 2:09pm On Mar 09, 2010 |
I was beginning to wonder whether there are still programmers in this section of the site cos it have been a long while i last saw codes posted here in the form of tutorial for others to learn from. Well it is a good come back again, but some how i have started wondering what is happening in here today you post something interesting and tomorrow it is gone in to oblivion with no trace, i did not complain at all rather i watched and started seeing others too complaining about post been deleted. I saw the explanation that it was a bot that targets post that look like spam and get it deleted. This i must say started recently. I may not be surprised if later today this post of mine will be attacked too by the bot. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by cdeveloper(m): 2:19pm On Mar 09, 2010 |
JavaScript i must say is one language that i have spent well my entire Service year studying way back in 2007, and till today it is a language that i am yet to understand its philosophy because when you think that there is just one way to write code in JS you will be surprised to learn that there are millions of ways to achieve the same thing in JS. One thing i have kept at the back of my mind ever since i learned JS is that Everything in Javascript is an Object and with that i have been able to write object oriented js codes;unlike other languages, javascript is the only language that even ordinary function is an object meaning that you can assign properties(both member variables and methods) to a function that you just created. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 2:25pm On Mar 09, 2010 |
cdeveloper, you are right. Just that i have been too busy will also have been droping tutorial. But thats why dhtml is here. See the more longer it takes u to understand stuffs, the better u will, if u evemtually do. Like php, na war for mr before, but no, i program full working smart games and applications with it. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by donline: 3:10pm On Mar 09, 2010 |
LET GET D CODE MOVING IS ALL ABOUT CODE |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 6:46pm On Mar 09, 2010 |
All the codes posted above are outdated. i have upgraded them. Now with ajax, if you post 2 simulataenous ajax requests, some may get overriten, due to the fact that ajax calls cannot be private. So i solved the problem by using chaining. I created one framework like that which is similar to jQuery, i talked about it on .com and also some code demos. Anyway, the solution was to do chaining, which is a process such that, several functions make an ajax request, the requests are pilled up by the ajax wrapper, which will execute the requests one at a time, and will return the stuffs using a callback function. That issue of codes dissappearing after posts has discourages me from continuing my tutorials (as well as my looooong i think 2-3 months ban last year) |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 8:07pm On Mar 09, 2010 |
*DHTML, i like all this shits u are saying. Men chain and padlock. DHTML na real baba oh but Donpuzo na King-kong wey dey program. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 9:56pm On Mar 09, 2010 |
lol @ padlock. na u sabi self. you are not called don for nothing. all those chains and stuffs na story jare. . .we can live without them |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 10:03pm On Mar 09, 2010 |
Sure i know. Most time i even instead of using Ajax to fetch datas, can script the php to its self. Afterall, no page refresh go shele. ![]() |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 10:20pm On Mar 09, 2010 |
Donpuzo:again, if you do not wish to use ajax, there is this script i have that make use of an iframe. . .and at the end of the day, the output is the same as ajax on the surface. However, it can upload pictures and stuffs, unlike real ajax. I made use of this on www.mybusinesspals.com - the photo uploads and some other areas |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 10:31pm On Mar 09, 2010 |
hmmmm, You don use padlock and chain skill dull me. Now na format 3 u dey use. Oda ro baba mi. Mo fe lo sun. Me o le paro fu en wahala coding ti dabaru english i e mi. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 10:35pm On Mar 09, 2010 |
whaddaya mean? coding has scattered your siinglishinesse keh? no way. <script type="nigera/lagos" language="singlish" direction="lagos-ajegunle" media="webmasters"> |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 10:47pm On Mar 09, 2010 |
i like that print<<<dhtml dhtml Skill u used there, i wanna replace it with what i used for marknollis forum. I used printdownhtml and it prints "printdownhtml" too can you imagine. So i wanted to do that in my next update, but no time. Thanks for using ur coding ways to remind me of what nest to do <?php $dhtml="friend" $afam="hater" $donpuzo="friend" if($dhtml==$donpuzo){ echo("DHTML na my paddy" ![]() } else echo "Na my guy sha" ?> Abeg na the best my head fit remember this night maybe i for use array self |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by quadrillio(m): 12:33pm On Mar 10, 2010 |
yo man !!!, I'm with you bro. |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by Nobody: 1:21pm On Mar 10, 2010 |
thank you jare, mr qadri |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by sisqology(m): 1:35pm On Oct 17, 2012 |
Hmmm |
Re: Moving To Oop Javascript/php Class Module Creation & Instantiation by trytillmake(m): 1:38pm On Oct 18, 2012 |
quadrillio: yo man !!!, I'm with you bro. Bros where u dey since, i remember when i heard of nairaland,yr tutorials on php where amongst the first i saw.Thanks and to dhtml abeg carry on the good work but u nr 4 wait make smebody spur u on just dey do am dey go ,people are always with u. |
(1) (Reply)
Free Cgpa Calculator For Undergraduate Written With Php / Mobile Browsing Overtakes Desktop Browsing In Nigeria / Can't Log In To Wordpress Dashboard After Mistakenly Changed Url To HTTPS
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 47 |