Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,165,776 members, 7,862,553 topics. Date: Sunday, 16 June 2024 at 07:23 PM

Why Is OOP PHP So Confusing? - Programming (2) - Nairaland

Nairaland Forum / Science/Technology / Programming / Why Is OOP PHP So Confusing? (6827 Views)

Learn Object Oriented Programming (OOP) AT SANDCROFT SOFTWARE / After 5 Months Of Learning OOP In Visual C#-here Is A Little Project I Made. / I Want To Learn Php Oop! Prescribe An Ebook (2) (3) (4)

(1) (2) (Reply) (Go Down)

Re: Why Is OOP PHP So Confusing? by Nobody: 2:05pm On Feb 16, 2016
sinequanon:


MVC is not a luxury. It is a fundamental paradigm specially designed for scalability. If you do not understand MVC, you have probably bitten off more than you can chew.
Our OP is looking for what we call - a quick and dirty way - in programming to quickly finish the project and chop the money.
Re: Why Is OOP PHP So Confusing? by Nobody: 3:43pm On Feb 16, 2016
sinequanon:


MVC is not a luxury. It is a fundamental paradigm specially designed for scalability. If you do not understand MVC, you have probably bitten off more than you can chew.

DHTML leave this one. Nairaland programmer na so so mouth them get.

I don collect my money today self.


Ode.
DHTML thanks for the wrapper tho.
Re: Why Is OOP PHP So Confusing? by Nobody: 4:14pm On Feb 16, 2016
Programming Language was made to solve problems and not create one.

But nairaland programmer won't/can't solve a simple problem, rather they will create multiple, countless problems from the already available problem.

With the smile I put on my client face yesterday, he has given me a go ahead to developed another system and also told me to go and install my school Management system in his school.

Thanks to some guys here for suggesting solution
Re: Why Is OOP PHP So Confusing? by ivcraig(m): 5:57pm On Feb 16, 2016
Guys please help out.
I'm trying to cleanup my the links on a website I'm working on, using htaccess. My rewrite rule works fine, but the images on the page don't display because a part of image links are also rewritten.

I'm rewriting view_music.php?id=$1&title=$2 to: track/id/title
track/id/title gets appended to all image links.
Re: Why Is OOP PHP So Confusing? by Nobody: 7:35pm On Feb 16, 2016
GetAvenue:


DHTML leave this one. Nairaland programmer na so so mouth them get.

I don collect my money today self.


Ode.
DHTML thanks for the wrapper tho.
You are welcome o jare. No mind all the fights, na fight nairaland programmers sabi fight, to code them no fit code! To solve problem, na fighting and distraction!
Re: Why Is OOP PHP So Confusing? by Nobody: 7:36pm On Feb 16, 2016
ivcraig:
Guys please help out.
I'm trying to cleanup my the links on a website I'm working on, using htaccess. My rewrite rule works fine, but the images on the page don't display because a part of image links are also rewritten.

I'm rewriting view_music.php?id=$1&title=$2 to: track/id/title
track/id/title gets appended to all image links.

Post the haccess here for immediate debugging.
Re: Why Is OOP PHP So Confusing? by ivcraig(m): 6:16am On Feb 17, 2016
Options -Indexes
ErrorDocument 404 /index.php
RewriteEngine on
Rewriterule ^home index.php [NC,L]
Rewriterule ^events events.php [NC,L]
Rewriterule ^music music.php [NC,L]
Rewriterule ^articles articles.php [NC,L]
Rewriterule ^article article.php [NC,L]
Rewriterule ^news news.php [NC,L]
Rewriterule ^ministration ministration.php [NC,L]
Rewriterule ^tracks/([0-9]+)/([0-9a-zA-Z_-]+)$ view_music.php?page=$1&title=$2
Re: Why Is OOP PHP So Confusing? by ivcraig(m): 6:18am On Feb 17, 2016
Ive tried all advise and its still same thing. I wish there was a better way
Re: Why Is OOP PHP So Confusing? by Nobody: 6:25am On Feb 17, 2016
ivcraig:
Ive tried all advise and its still same thing. I wish there was a better way

If your images are stored in lets say images folder,
then try something like this in your .htaccess

RewriteCond %{REQUEST_URI} !/images

put that after the RewriteEngine on
Re: Why Is OOP PHP So Confusing? by ivcraig(m): 7:16am On Feb 17, 2016
dhtml18:


If your images are stored in lets say images folder,
then try something like this in your .htaccess

RewriteCond %{REQUEST_URI} !/images

put that after the RewriteEngine on
Thanks bro. I tried it but didn't work. This just worked tho:
Rewriterule ^tracks-([0-9]+)+([0-9a-zA-Z_-]+)$
instead of:
Rewriterule ^tracks/([0-9]+)/([0-9a-zA-Z_-]+)$
I changed the slashes to dashes. I guess the slashes convert the link to directories. I also feel this is not appropriate.
Re: Why Is OOP PHP So Confusing? by Nobody: 4:35pm On Feb 17, 2016
Great that you have solved the problem, .htaccess can be a bit crazy atimes. Sometimes when you move your stuff to online server, you may start another battle again.

2 Likes

Re: Why Is OOP PHP So Confusing? by ivcraig(m): 6:57pm On Feb 17, 2016
dhtml18:
Great that you have solved the problem, .htaccess can be a bit crazy atimes. Sometimes when you move your stuff to online server, you may start another battle again.
I hope this solves it permanently. I checked WordPress, laravel and codeigniter's own Htaccess. They seem to have a generic approach to rewriting links. I guess php also plays a major role.
Re: Why Is OOP PHP So Confusing? by Nobody: 7:09pm On Feb 17, 2016
Yeah, i recommend the use of altorouter - http://altorouter.com/ for routing
Re: Why Is OOP PHP So Confusing? by ivcraig(m): 8:05pm On Feb 17, 2016
dhtml18:
Yeah, i recommend the use of altorouter - http://altorouter.com/ for routing
Thanks bro. I really can't figure out how to use it. I'm still stuck with procedural php orientation. I think it's high time I started to take this oop serious. Everything on the Web nowadays are objects.
PHP object orientation dey turn my head.
Re: Why Is OOP PHP So Confusing? by FrankLampard: 11:10pm On Feb 28, 2016
ivcraig:

Thanks bro. I really can't figure out how to use it. I'm still stuck with procedural php orientation. I think it's high time I started to take this oop serious. Everything on the Web nowadays are objects.
PHP object orientation dey turn my head.

I'm going to dropping a tutorial soon. I will share the link when I am thru.

1 Like

Re: Why Is OOP PHP So Confusing? by FrankLampard: 3:19pm On Feb 29, 2016
ivcraig:

Thanks bro. I really can't figure out how to use it. I'm still stuck with procedural php orientation. I think it's high time I started to take this oop serious. Everything on the Web nowadays are objects.
PHP object orientation dey turn my head.

Hell bro, here is the tutorial as I promised. If you have any question feel free to drop them on the thread.

https://www.nairaland.com/2963456/hello-house-lets-little-php

1 Like

Re: Why Is OOP PHP So Confusing? by AnthonyAk(m): 11:11pm On Mar 01, 2016
sinequanon:


MVC is not a luxury. It is a fundamental paradigm specially designed for scalability. If you do not understand MVC, you have probably bitten off more than you can chew.

What this guy said , cant imagine the code you have written without MVC . You are in for a ton of headaches when it comes to maintaining the code.

I brief run down on OOP and why its important.

Organizes your code into classes i.e


public myClass{
public function foo(){
return 'bar';
}
}

$CLASS = new myClass();


you can now access your methods like

echo $CLASS->foo();


methods can also be access from withing the main class like so

public myClass{
public function foo(){
return 'foo';
}
public function bar(){
$foo = $this->foo();
return $foo.'bar';
}
}


Your code scales a bit better as your dont have to repeat yourself.

Class Inheritance also makes your life a bit easier i.e

public yourClass extends myClass{
//yourClass has access to all methods of myClass
}


this is just a tip of the ice berg.

MVC

MVC = Model , View , Controller

Model = Database structure
View = HTML or PHP code that displays the data
Controller = the link between the view and the controller

Its standard to seperate all three for scalable applications no matter what language you use

I hope this sort of touched on the topic . i personally enjoy using laravel really powerful piece of software

1 Like

(1) (2) (Reply)

What Kind Of DBA (Database Administrator) Are You? / So What Happened To Andela In Nigeria? / How Can I Recover My Facebook Account That Has Hacked?

(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. 28
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.