Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7767267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:38:04+00:00 2026-06-01T15:38:04+00:00

I am trying to wrap my head around PHP OOP and after reading everything

  • 0

I am trying to wrap my head around PHP OOP and after reading everything I can I understand fully how it works but before I invest too much time in learning to change my inline, procedural habits I wanted to be sure it could even accomplish what I need or if I am way off track.

I have a PHP / MySQL site that started as a side project but is growing quickly and I am trying to ensure that my skills can keep up. The site has users and companies. The users side is fairly static and I’m able to handle minor changes in what is displayed with my newbie PHP skills. On the company side I tried to make it very customizable for the companies which they love but I quickly realized I had a problem because now I have 50 pages of code per company that was being modified and then dumped into folders based on what the company wanted on their site. So everytime a company came on board I copied the previous companies files into a new file folder in my web root and customized a bunch of stuff for them. I’ve put some functions into most of the pages to narrow the number of pages down to about 20 but my question is can OOP bring me all the way home to where I am just maintaining one site and is that the purpose of OOP? I have things like javascript (shown below) that changes based on what the customer wants in their grid system. Can someone help me wrap my head around the basics of what I should be learning to do here? Should I be learning to make each page one big object and include the javascript below in that object or is the OOP just for PHP and I am stuck with at least a few pages of code ending up in a new folder everytime a customer comes on or do I just limit what can be customized? I am not afraid to learn something new, just want to be sure I’m on the right track and the hole I’m in is getting deeper quickly so time is short. Thanks for any help with this concept. I feel there is some basic understanding that I’m missing…

var mygrid;         
            function doInitGrid(){  
            mygrid = new dhtmlXGridObject('gridbox');
            var combo=mygrid.getCombo(4);
            combo.put(2, 'Approve / Deny');
            combo.put(1, 'Approve');
            combo.put(0, 'Deny');
            mygrid.setImagePath("../codebase/imgs/");           
            mygrid.setHeader("Submit Date, Manufacturer, Product Category, Progress, Approval Status",null,["text-align:center;","text-align:center;","text-align:center","text-align:center","text-align:center"]);        
            <!--mygrid.attachHeader("#text_filter,#text_filter,#text_filter");-->
            mygrid.setInitWidthsP("10,16,44,18,12");
            mygrid.setColAlign("center,left,left,center,center");
            mygrid.enableAutoWidth(false);
            mygrid.setColTypes("ro,ro,ro,button,coro");
            mygrid.setColSorting("str,str,str,str,str,str");
            mygrid.enableRowsHover(true,'grid_hover');              
            mygrid.setSkin("modern");
            mygrid.init();          
            mygrid.setStyle("font-size:11px;","font-size:11px;","font-size:11px","font-size:11px","font-size:11px");
            mygrid.loadXML("connector.php?hospid=<?php echo $hospid; ?>");
            mygrid.setColumnIds("date,man_name,group,approval_progress, approval_status");          
            var dp = new dataProcessor ("connector.php?hospid=<?php echo $hospid; ?>");     
            dp.init(mygrid);                        
            dhxWins = new dhtmlXWindows();
            dhxWins.setImagePath("../codebase/imgs/");          
            mygrid.attachEvent("onRowSelect", function(id,ind){ 
                 if (ind == 0 || ind == 1 || ind == 2 || ind == 3){  
                dhxWins = new dhtmlXWindows();
                var w1 = dhxWins.createWindow("w1", 60, 60,925, 575);
                dhxWins.setSkin("dhx_web");
                dhxWins.setImagePath("../codebase/imgs/");
                w1.centerOnScreen();
                w1.setText("");
                w1.setModal(false);
                theVar11 = (id);
                w1.attachURL("pop_details.php?var1=" +theVar11);
                return true;
                 };
                 });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:38:05+00:00Added an answer on June 1, 2026 at 3:38 pm

    Hmmm

    I would say that OOP can be very handy here!

    First of all, you would want to make all your HTML pages separate from your PHP pages. Reduce the clutter for yourself.

    Second, i your PHP create a parent class that has major profile functionality. This will work for you later down the road because you can pass in a few parameters to your class that will update all the relevant information for your user profiles.

    When working with a large site like the one yours seems to leaning to, it will make your job as a developer easier to either follow an MVC system or to create your own system.

    As an example to your case, create a file called Profile.class.php

    class Profile
    {
       public function __construct() {}
    
       public function updateUser($user)
       {
           // run code to update 1 user here
       }
    }
    

    in your profile.php page

    you can have something like

    $obj = new Profile();
    
    if ($_GET['update']) {
       $obj->updateUser($_SESSION['user']);
    }
    

    thats how you would be able to benefit from an OOP approach.

    The choice is yours.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to wrap my head around setTimeout , but I can't get it
Im trying to wrap my head around MVVM. I understand a lot of it,
I'm trying to wrap my head around Object Oriented programming. But I'm having some
I'm trying to wrap my head around custom paging in the ASP.NET Gridview, but
I'm trying to wrap my head around PHP and XML. I'm trying to do
I'm trying to wrap my head around this, but I seem to go in
I'm trying to wrap my head around RESTful design, and I'd like to understand
I'm trying to wrap my head around regex, but would appreciate some help on
Im trying to wrap my head around this but am spending too much time
I'm trying to wrap my head around something that I can't seem to figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.