Jump to content

What to do with my PHP code base?


Recommended Posts

I've got a monumental problem on my hands...¬†¬†ūüėā

The website that I've been working on - for years - for my startup business is just about done, but because I have taken so long to code things, my HTML is very outdated, and is *not* mobile friendly.

I was hoping to go live with my website in the next month or two, but considering that over half of Internet users are on mobile, it makes me wonder if I should release my rigid, un-responsive website as-is, or take months trying to re-tool things.

That, in itself, will be a monumental task, BUT it also makes me wonder if I will break all of my tens of thousands of lines of PHP and MySQL?

A very loaded question, for sure, but if you were me, what would you do?

What I am really fearful of is FUBAR'ing my PHP code which I have spent thousands of hours testing and am hesitant to even blink at?!

Edited by SaranacLake
Link to post
Share on other sites
  • SaranacLake changed the title to What to do with my PHP code base?

Updating your HTML/CSS may or may not be easy, but we need to see it. If it is complicated upload it to a free host 000webhost might work https://www.000webhost.com/

You can try your PHP there also. How did you check your php before. Did you use something like Webampserver? It probable is OK.

Edited by NotSunfighter
Link to post
Share on other sites
4 minutes ago, NotSunfighter said:

Updating your HTML/CSS may or may not be easy, but we need to see it. If it is complicated upload it to a free host 000webhost might work https://www.000webhost.com/

You can try your PHP there also. How did you check your php before. Did you use something like Webampserver? It probable is OK.

Sure, upload my entire code-base for you to review...

Would you like a copy of my financials as well?

Link to post
Share on other sites

If your code is well thought out to begin with, making it responsive is CSS-based and shouldn't be that big a deal in the grand scheme of things; in other words, it shouldn't touch your php much or at all. It may require some rethink on your html, but even then that should be pretty minimal.

If you've got a ton of inline styles well, that's a different story, but you'll eventually have to redo the site to fix that anyway...

So basically, as long as the functionality is complete and tested, push to production now and start refactoring right after that.

Edited by maxxd
Link to post
Share on other sites
1 minute ago, requinix said:

Is there a downside to releasing now?

I don't want to say my HTML/CSS is sh*t, but it IS very outdated - as in like from 8 years ago.

Back then, mobile was an after-thought, and most people still browsed the web on laptops or PCs.

As a for instance...  For whatever stupid reason, all of my web pages either have a left margin/padding to center things, and/or use a min-width setting which pretty much trashes things on mobile, because you have a white "gutter" on the left and have to scroll right to see the whole page.

I feel like that makes my website a "dead duck in the water".

The problem is that my website has LOTS of functionality - and it isn't some cutesy WordPress blog or SquareSpace site.

Right now my code-base is like 60,000 lines of code and hundreds of files.

How did I get to this point?

Death in the family, a medical condition, job loss, the pandemic, etc.

I feel like I am in a lose-lose situation.

I was supposed to finish the e-commerce module of my website last spring, and then go live by like April.  The pandemic really screwed that up.

I have a month or two of coding to do to finish the e-commerce module, and I am wondering now if my 1st priority should be making my website - or at least 80% of it - mobile instead?

 

Link to post
Share on other sites
4 minutes ago, maxxd said:

If your code is well thought out to begin with, making it responsive is CSS-based and shouldn't be that big a deal in the grand scheme of things; in other words, it shouldn't touch your php much or at all. It may require some rethink on your html, but even then that should be pretty minimal.

If you've got a ton of inline styles well, that's a different story, but you'll eventually have to redo the site to fix that anyway...

So basically, as long as the functionality is complete and tested, push to production now and start refactoring right after that.

I don't know OOP, so I code everything like a use-case, i.e. 1st do this, then do that, then do the next thing.  All of my PHP scripts start off with the PHP at the top and then HTML at the bottom.  So, in theory, things are fairly separate.

I guess my larger fear is that I just can't seem to "get the football in the endzone".

Speed has never been my strength, and while what i have is solid from an end-product, it also isn't mobile.

If you landed on my home page or tried to read a basic article, you'd be scrolling to the right quite a bit since it is built for a 1028 X 768 world.

I guess there is no harm in releasing things as coded, but if everyone is on mobile and they ditch after 5 seconds, then why release things as-is, right?

 

 

Link to post
Share on other sites
2 hours ago, SaranacLake said:

I guess there is no harm in releasing things as coded, but if everyone is on mobile and they ditch after 5 seconds, then why release things as-is, right?

Because of the other 50% of the internet that isn't mobile?

Link to post
Share on other sites

I will chime in with my thoughts. I bet most of your website could be fixed to look good on mobile devices by doing some CSS tweaks. It doesn't have to look the greatest as all it needs to look good.

 

Here's what I do, first for all browsers including mobile:

/*--------------------------------------------------------------
Basic responsive layout for all browsers:
--------------------------------------------------------------*/

.site {
  background-color: #fff;
  max-width: 75em;
  margin: 0 auto;
}

Then inside a media query for modern browsers (Firefox, Chrome for PCs)

    .site {
      max-width: none;
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      grid-template-rows: auto;
      grid-gap: 0;
    }

Sure it isn't going to look as polished as some of the major sites that you see, but people will be able to see comments and other thing information in a nice pleasing style that goes from edge to edge that is one right after another down the screen when they scroll. You and always go back to the restyling for mobile if you so decided to. BTW the .site class is in the HTML <body> tag.

Edited by Strider64
Fixed CSS to not use variable
  • Great Answer 1
Link to post
Share on other sites

Are you able to break you implementation into two basic applications?

  1. All your PHP/SQL script.  It receives a HTTP request, calls the appropriate  method to do something (CRUD) and either returns JSON or gives the PHP array to a view.  Use something like https://www.slimframework.com/ to map between the request and the PHP script you execute.
  2. All your HTML, JS, CSS.  If the above provides JSON, this will need to be setup to forward the request from the client to the above app, or you can set it up to be more integrated to have the above part just pass the resultant data array to this application. 

If so, you will then be able to hire someone to do just the second part of the application, and not have to worry about all your PHP/SQL scripts.  The JSON route might be easier as it more isolates the two scopes of work.  You also will be giving someone a very defined scope as each of your pages are already working and it will be very clear what you want from a UX perspective.  You will, however, need to take steps to define the interaction between the two parts, and will need to give a narrative for each endpoint or maybe use swagger or similar to document.  While you can make all your client script available, I wouldn't expect them to use any of the HTML and CSS but just to use some framework like bootstraps instead.  I am sure it is a daunting task, but if the two scopes remain completely intertwined, it will be impossible to find someone without paying  significant money.

Or, maybe don't worry about it or better yet go with Strider's quick lipstick on a pig approach, and go forward with your venture.

Link to post
Share on other sites
7 hours ago, Strider64 said:

I will chime in with my thoughts. I bet most of your website could be fixed to look good on mobile devices by doing some CSS tweaks. It doesn't have to look the greatest as all it needs to look good.

Thanks, but if it was as easy as a few lines of CSS, then i wouldn't be here...

 

 

Link to post
Share on other sites
58 minutes ago, NotionCommotion said:

Are you able to break you implementation into two basic applications?

No.

As mentioned, I code like a use-case where each script is a particular function from start to finish.  (Would love to learn MVC for v2.0)

I'm still kicking things around, but at the end of the day it probably makes most sense to finish my e-commerce module coding like I have, go live with my site, then start from scratch on v2.0 instead of trying to "fix" my un-mobile website.   (Having worked in IT for my entire life, I have never seen a "fix it" project that ended well, because you can't fix crap!)

Still, it makes me sick to think of all of the people (more likely 80%) I will lose because my website won't play well on mobile.¬†ūüėā¬†¬†

 

Link to post
Share on other sites

If your PHP is also about 8 years old, it's going to need to be redone anyway, and probably sooner rather than later. I'd recommend pushing the site live when the e-commerce part is done, tested, and validated/verified. Then use a strangler fig pattern to iterate on the code, refactoring and replacing bits and pieces as you go. You can make changes to the HTML (PHP output, whatever) and CSS without touching the PHP. You could even start ripping out procedural code and converting to a more modern, extendable and maintainable code-base.

Edited by maxxd
my spelling is terrible
Link to post
Share on other sites
16 minutes ago, maxxd said:

If your PHP is also about 8 years old, it's going to need to be redone anyway, and probably sooner rather than later.

Don't remind me!

 

16 minutes ago, maxxd said:

I'd recommend pushing the site live when the e-commerce part is done, tested, and validated/verified.

Okay.

 

16 minutes ago, maxxd said:

Then use a strangler fig pattern to iterate on the code, refactoring and replacing bits and pieces as you go. You can make changes to the HTML (PHP output, whatever) and CSS without touching the PHP. You could even start ripping out procedural code and converting to a more modern, extendable and maintainable code-base.

My dream for v2.0 is to FINALLY learn MVC and OOP and rewrite my entire website in somethng like Python.  (Also making it "mobile first".)

Maybe if the world - and my world by proxy - stop melting, I can achieve that?!

After freaking out last night, I have calmed down a bit, plus I realize that a lot of how my front-end is designed makes it incompatible with mobile, so a simple rewrite isn't possible - I will need to re-architect the front end to be truly entirely mobile.  And some of that means I will need to re-architect the backend as well.

I don't know how these 20-somethings code something like Facebook or Twitter overnight and become billionaires by 30?!  (I just hope to see my website go live - and prosper - before I die in say 20 years!!

Link to post
Share on other sites
On 1/3/2021 at 12:29 AM, SaranacLake said:

 

As a for instance...  For whatever stupid reason, all of my web pages either have a left margin/padding to center things, and/or use a min-width setting which pretty much trashes things on mobile, because you have a white "gutter" on the left and have to scroll right to see the whole page.

This is not the problem you seem to think it is.  Really the only really insurmountable problems that can't be fixed with media queries, would be if you are styling predominately through the use of inline style statements echo'd in your php code, or if you have the entire site layout in multiple nested html tables, as was the case for many a site in the olden days.  

Something as trivial as a margin/padding etc. is not a problem at all.   You do a media query and simply change the things that are not mobile friendly.  For example:

@media only screen and (min-width: 320px) and (max-width: 480px) {
	.logo img {
		width: 60px;
	}
	.company-name {
		margin: 0;
		padding: 0;
		font-family: Helvetica,Arial,sans-serif;
		font-size: 25px;
	}
  
	.company-pictures {
		display: none;
	}
}

Simple examples of common things you might do for mobile (use a smaller or different image for a logo, redefine a style class you apply to certain elements, completely hide a block that is nice to have but not essential for mobile users).

 

For the record, 8 years ago there were a lot of things available that you could have used to build your site with.

MVC frameworks like Zend Framework (2006), CakePHP (2005) and CodeIgniter (2006).  

Symfony 1 was released in 2007.  

Symfony2 was released in 2011.  Not long after that, composer was released.  Laravel was released in June of 2011. 

I have made efforts to make you aware of some of these projects in the past.  

Fear of breaking things you manually tested should not be an excuse not to change code, either permanently or experimentally.

Is your code in a git repo?  Have you pushed this to a private repo under github or bitbucket?  If not, why not?  If so---

Here's what you do:

  • Make a branch (git checkout -b css-test
  • Change as much or as little code as you want to experiment
  • Commit your changes
  • (Optionally) push your branch to your repo [while in branch] git push -u origin css-test

If it goes to hell, no big deal, you made a branch and you can delete it if you want.  If things work out, you merge your branch to master.  

Link to post
Share on other sites

In the days before mobile was big, making a site mobile-friendly was often a matter of taking an existing site and disabling some of the nuisance CSS rules - centered margins, fancy effects, etc. That technique may not produce professional-level results by today's standards, but it can still be quite effective in a pinch.

Link to post
Share on other sites

I feel your pain, the only advice I have is 

We all know the saying is if a job is worth doing it is worth doing well.

I used to think like that till I started thinking about this, I am not suggesting that you should do shoddy work, I am saying get out and do the job.

You may not have the skills or the knowledge to do it perfectly, yet the satisfaction of getting it done will exceed the concern about it not being perfect.

Too many projects die a slow death because people want perfection. MS DOS and Windows would still be an idea if the job wasn't worth doing badly.

Get the job done. Improve it and improve your skills and knowledge so that the job done badly can be made better after it's real.

  • Like 1
Link to post
Share on other sites

@gizmola,

You're alive?!  (Was afraid COVID got you...)

 

On 1/6/2021 at 2:00 AM, gizmola said:

This is not the problem you seem to think it is.  Really the only really insurmountable problems that can't be fixed with media queries, would be if you are styling predominately through the use of inline style statements echo'd in your php code, or if you have the entire site layout in multiple nested html tables, as was the case for many a site in the olden days.  

Well, I understand media queries, but it IS more than just that.  One problem is that my code suffers from "DIV-itis" and is probably more complex than it needs to be, including too many nested DIVs, but 8 years ago that was necessary to get the effects I wanted and to cope with supporting IE6.

My other issue is that it seems to be much easier to code HTML and CSS *after* your website is done.  In other words, after your site is done, then it's easy to identify patterns and be smarter with styling.  My website was something that took years to cobble together, and my HTML and CSS shows that.

It was also build in the days of 15-inch/17-inch monitors being the standard.

 

On 1/6/2021 at 2:00 AM, gizmola said:

Simple examples of common things you might do for mobile (use a smaller or different image for a logo, redefine a style class you apply to certain elements, completely hide a block that is nice to have but not essential for mobile users).

I have kicked this around since posting here, and I think it is best to do this....

First, I have created a "temporary" website so people have something to look at and that I can update like a mini blog and it is entirely mobile.

Second, I need to just finish my main website as is regarding HTML/CSS.

I will lose tons of people not having my main site done, so I better get it done ASAP!

The issue isn't finishing the site, it is that my site is tied to the news, and I am drowning in keeping up with our ever-changing world, and I simply can't spend the time I need to do coding AND create content that keeps up with the 24/7 news-cycle.

THAT is the real issue.

 

 

On 1/6/2021 at 2:00 AM, gizmola said:

For the record, 8 years ago there were a lot of things available that you could have used to build your site with.

MVC frameworks like Zend Framework (2006), CakePHP (2005) and CodeIgniter (2006).  

Symfony 1 was released in 2007.  

Symfony2 was released in 2011.  Not long after that, composer was released.  Laravel was released in June of 2011. 

I have made efforts to make you aware of some of these projects in the past.  

I was aware of those project in 2008.  I simply couldn't understand them, PLUS I wanted the challenge of coding my own site, not "configuring" some framework.

 

 

On 1/6/2021 at 2:00 AM, gizmola said:

Fear of breaking things you manually tested should not be an excuse not to change code, either permanently or experimentally.

Only a fool would screw with working code on a web application that is 90% done.  (You'd never see that in any Fortune-500 company I have worked for.)

Rather you ship what you have, then re-factor after you have a live site.

I don't have a live site.

So why risk breaking 100% of my finished code to support mobile?

In my OP, I wasn't sure.  But now I think it would take too much effort and take too much risk.

I'm sure the right body shop could cut up a Hyundai (i.e. my site) and *try* to make it a Mercedes (i.e. mobile), but the end result would never be the same as a real Mercedes.

 

 

On 1/6/2021 at 2:00 AM, gizmola said:

Is your code in a git repo?  Have you pushed this to a private repo under github or bitbucket?  If not, why not?  If so---

Because it is another thing I need to learn but don't have timef ro at the moment.

 

On 1/6/2021 at 2:00 AM, gizmola said:

Here's what you do:

  • Make a branch (git checkout -b css-test
  • Change as much or as little code as you want to experiment
  • Commit your changes
  • (Optionally) push your branch to your repo [while in branch] git push -u origin css-test

If it goes to hell, no big deal, you made a branch and you can delete it if you want.  If things work out, you merge your branch to master.  

Well, I can do that in NetBeans manually by creating a new project, so that is an idea.

But after coding a temporary mobile site, I think it's a fool's errand to try and "fix" my rigid desktop code for mobile.

Also, as mentioned above, there are some key sections of my current website that simply won't work on mobile and need to be re-engineered.  That isn't an HTML or CSS issue - rather a fact that what works on a 15-inch monitor won't work on an iPhone 6.  (Think of things like a 3-column layout, or a fixed top menu)

 

As always, valid points above, but I sorta painted myself into this corner and it is what it is.

I am so far behind shipping my site, it really doesn't matter at this point.

The best thing to do it finish my e-commerce module so I have a way to collect $$$, then publish my site, then fill it with content, then IMMEDIATELY strat re-engineering thigs for "Mobile First" and see if I can do it piece-meal and maybe convert a section of my legacy site at a time.

 

Link to post
Share on other sites
On 1/6/2021 at 3:56 AM, requinix said:

In the days before mobile was big, making a site mobile-friendly was often a matter of taking an existing site and disabling some of the nuisance CSS rules - centered margins, fancy effects, etc. That technique may not produce professional-level results by today's standards, but it can still be quite effective in a pinch.

True, but my biggest issue is that my website looks like  a newspaper - with 3 columns - and the assumption that people have AT LEAST 15-inch screens.

My website is horizontal.  The modern world is vertical and requires both scrolling, and intelligent design to know when to add/subtract things (e.g. hamburger menus).

My site was designed well for 8-10 years ago, but i was too slow to publish it, and now it is outdated.

If I could ever understand MVC, OOP, and GiT I could jump light-year ahead.

My code runs well and is solid, but it is a bitch to update, and because how I code, it is not "agile".

And please don't anyone say, "Oh, MVC, OOP, and GiT are easy."  If they werre easy to learn - for ME - then I would have used them 10 years ago.  (Well, i suppose GiT isn't too hard.)

But I haven't given up, and I hope to master MVC and OOP and mobile in v2.0 of my life!!!

 

Link to post
Share on other sites
On 1/7/2021 at 9:54 AM, guymclarenza said:

You may not have the skills or the knowledge to do it perfectly, yet the satisfaction of getting it done will exceed the concern about it not being perfect.

This.

 

On 1/7/2021 at 9:54 AM, guymclarenza said:

Too many projects die a slow death because people want perfection.

This.

 

On 1/7/2021 at 9:54 AM, guymclarenza said:

MS DOS and Windows would still be an idea if the job wasn't worth doing badly.

Well, nobody knows more about shipping a piece-of-crap than Microsoft!  *LMAO*

I am aiming higher than that, BUT, I should probably give up on perfection too!

 

 

On 1/7/2021 at 9:54 AM, guymclarenza said:

Get the job done. Improve it and improve your skills and knowledge so that the job done badly can be made better after it's real.

This.

 

I think I know how the people working on BetaMax felt...¬† ūüėČ

 

 

 

Link to post
Share on other sites
10 hours ago, SaranacLake said:

And please don't anyone say, "Oh, MVC, OOP, and GiT are easy."  If they werre easy to learn - for ME - then I would have used them 10 years ago.  (Well, i suppose GiT isn't too hard.)

Some sort of version control is worth the effort to learn.  Git isn't too bad, and is where most things are going these days.  There's others available though you could try.  I still make heavy use of Subversion and it's fairly easy to use on windows with a tool like TortoiseSVN. 

 

Link to post
Share on other sites
48 minutes ago, kicken said:

Some sort of version control is worth the effort to learn.  Git isn't too bad, and is where most things are going these days.  There's others available though you could try.  I still make heavy use of Subversion and it's fairly easy to use on windows with a tool like TortoiseSVN. 

 

I believe that NetBeans has Subversion but into it.  I think I have used that to "undo" a given PHP file, but I'm not sure it works at a project level like you'd normally do with a normal configuration mgt tool.

 

Link to post
Share on other sites

As far as I can tell, it's good. Nice thing for me is BitBucket offers unlimited free private repositories with up to (I believe - it's been a while since I checked) 5 contributors per repository. So for a small team or independent developer with friends, totally free forever. And SourceTree is free no matter what - you can use as many different accounts on as many different repository hosts as you want - BitBucket, GitHub, GitLabs, or Azure.

Good lord, I should get a commission. Of course, a commission on free is pretty much what I'm already getting, so there ya' go.

Edited by maxxd
math
  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.