Jump to content

SaranacLake

Members
  • Posts

    648
  • Joined

  • Last visited

Posts posted by SaranacLake

  1. @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.

     

  2. 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!!

  3. 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. 😂  

     

  4. 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...

     

     

  5. 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?

     

     

  6. 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?

     

  7. 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?

  8. 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?!

  9. @kicken

    How does this look...

    	# REWRITE TO WWW
    #-------------------------------------------------------------------------------
    # RewriteCond %{HTTP_HOST} !^www\. [NC]
    # RewriteRule ^(.*)$ https://www.%{HTTP_HOST}$1 [L,R=301]
    	
    # REWRITE TO HTTPS
    #-------------------------------------------------------------------------------
    #RewriteCond %{HTTPS} !=on
    #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    	

  10. 5 minutes ago, kicken said:

    This concept has to do with Canoical URLs, you should choose which URL format you want and the redirect everything else to that one format through either your code or server configuration.  In simple cases the search engines may figure it out, but it's best if you control the process yourself.

    There are a number of resources out on the web that can show you how to redirect your requests appropriately for whatever software you're using.

    So do I need two rewrites?

    The first rewrite to make any non-www URLs to www ?

    And then a second rewrite to make all www URLs https://www ?

     

    Or do I approach things from converting all non-www to https://www ?

    And then convert any www or http://www to https://www ?

     

    The point being that there are lots of combinations here, and I'm not sure what is the best way to do rewrite and redirects using my .htaccess file on my VPS?

     

  11. 10 minutes ago, requinix said:

    I'm sorry but it sounds like you're saying that your application is letting in bad data: invalid items in a non-member's shopping cart. That's the problem, isn't it? So how about fixing that problem?

    Actually, no, I'm just trying to be a good developer and checking twice!

    Yes, if a Member lands on the "Trial Offer" page, that script will prevent them from adding the "Trial Offer" to their shopping cart.  But I figured it would be a good idea in my checkout.php script to do an inventory of things and make sure everything is legit before I move forward.  (Bad data has a crazy way of sneaking in place you never expect?!)

     

    So back to my OP...

    I was looking at some old old code, and it looks like I could just use PHP to iterate through the user's shopping cart records, and then I can update each record that I come across - without necessarily needing an array - right?  

     

     

  12. Hello.

    I'm trying to figure out the most logical way to update my shopping cart (table).

    When my checkout.php script loads, I need to run some checks on all cart items and take appropriate action.

    For example, a "Trial Offer" is only available to non-Members, so if a Member somehow has a "Trial Offer" in his/her shopping cart then I'd like my checkout.php script to remove that automatically from the Member's cart.

    So when checkout.php loads, one of the first things I do is to read the user's shopping cart items from the database.

    But what is the most logical way to update the shopping cart table?

    Do I load the shopping cart records into an array, then iterate through them, remove any non-applicable "Trial Offers" and then write things back to the shopping cart table?  (If so, then how do I merge things?  This is what is confusing me...)

    Or do I somehow iterate through the shopping cart records for the user and update each record at a time and avoid loading things into memory like using an array?

    Again, this seems like a simple enough task, but I'm not sure the smartest way to do things?!

     

  13. 5 minutes ago, requinix said:

    No you don't. You have a function perfectly capable of giving you the current session ID. Why do you think you have to take that value, which is going to be the same value every time you call the function so long as the session is active, and put it into $_SESSION for you to get it?

    True.

     

    5 minutes ago, requinix said:

    If you want the session ID then call the function. Stop overthinking this.

    Told you I was rusty on all of this stuff...  

     

     

    5 minutes ago, requinix said:

    No. You see two session files. Containing session data. For two different sessions.

    Right, I meant Session "files".

     

     

    5 minutes ago, requinix said:

    How did you run those queries?

    That's a rhetorical question. You aren't supposed to tell me the answer. You're supposed to consider what the answer is and then continue thinking about the implications of that answer in order to find the answer to your question.

    I think I figured it out...

    That 2nd Session file is not from my code, it is from phpMyAdmin!!

    (Just for reference, should I ever see a query stored in my $_SESSION variable unless I am doing something crazy??  I would so, "No!")

     

     

     

     

  14. 2 minutes ago, requinix said:

    Why should it be? What good would that do?

    I don't know, it just seems like the $_SESSION variable should know/have it's own name?!  🤨

     

    So I guess I need to do this...

    	    session_start();
        $_SESSION['sessionID'] = session_id();
        
        var_dump($_SESSION);
        
        $sessionID = (isset($_SESSION['sessionID']) ? $_SESSION['sessionID'] : '');
        exit(); 
        
    	

     

    And then I can INSERT $sessionID into a new SHOPPING_CART record?

     

    Oh, one other thing...

    When I look under tmp > php I see two session variables.

    The first one is consistent with what I'd expect and contains...

    	test|s:5:"hello";
    	

     

    However, the other session variable has tons of stuff in it, include a couple of SQL queries...  (In fact, it includes the UNION query I was asking you guys about the other day in the MySQL forum!!)

    What is all of that about??

     

     

     

     

  15. 5 minutes ago, requinix said:

    :facepalm:

    I don't know what you saw in those Google results, but the first result in what I saw was a link to the session_id() function.

     

    I added an echo like this...

    	session_start(); 
    	echo session_id();  //new
    	var_dump($_SESSION);
    	exit(); 
    	

     

    So that echos what appears to be my session_id, but...

     

    Why isn't session_id stored in the session when I create it?

     

  16. 3 minutes ago, requinix said:

    I suggest you start your hunt for an answer over here.

    I finally found some useful info at php.net and found that PHP create a file for each new session and stores it here: session.save_path in the php.ini file.

     

    Questions:

    1.) In my PHP code, what should I be storing in my shopping_cart table for the session_id?  Is the file name that PHP create?

     

    2.) And how can I capture that and store it in my table?

     

     

  17. 10 minutes ago, requinix said:

    This "sessMemberID" is from your application. PHP isn't making it for you.
    It's probably the member.id value, but I suggest looking at your login code to be sure.

    Yeah, I looked at my login.php script and seems that, for logged in members, I store their "memberID" in the "$sessMemberID" variable.

     

     

    Quote

    The "session ID" is something else. It's a unique identifier that PHP does create for you. It is highly unlikely that you will ever need to care about it.

    So let me back up and explain why I'm asking about all of this.

    Right now I am working on building code to add items to the user's shopping cart.

    In my SHOPPING_CART table, I have a column for "member_id" which works great is a user is also a member and logged in.

    But for members that are not logged in, OR for users who are not yet members, I want to use the Session "session_ID" who that I can store whatever a user put into his/her shopping cart.

     

    I just added this to my home page...

    	session_start();   //existing
    	var_dump($_SESSION);  //new
    	exit();  //new
    	

     

    If a user isn't a member and thus not logged in, then the above code shows "empty" when I load the home page.

     

    So once I start the PHP session, how do I find the "session_ID" so that I can store it in the SHOPPING_CART table and associate it with that random user/visitor??

     

     

     

  18. I could use some help remembering how sessions and cookies work...  (Looks like another thing I have forgotten about!)

    In one of my old scripts, I start a session using...

    	session_start()
    	

     

    And then I have...

    	$sessMemberID = (isset($_SESSION['sessMemberID']) ? $_SESSION['sessMemberID'] : '');
    	

     

    It appears my old naming conventions aren't so clear after being away for several years...

    In my database I have a MEMBER.id (table/column) which is just an AutoNumber,  and I thought that PHP create a "Session ID" but that it was some long hexadecimal number?

     

    So it's not clear to me what is in $sessMemberID.

     

    I tried to look in the cookies file under my Firefox profile, but when I open it in BBEdit all i see is gibberish in that file.

     

    Can someone please help me put these disparate parts together?

     

    Thanks!

     

  19. In one subtype I have a field called "title" and in another substype I have a field called "name".

    When I use a UNION, I am able to get them to appear in the same column, but it seems that the column name adopted is just the first query

    	SELECT p.id, p.sku, mp.product_id, mp.name
    	FROM product AS p
    	INNER JOIN membership_plan AS mp
    	on p.id = mp.product_id
    	UNION
    	SELECT p.id, p.sku, bk.product_id, bk.title
    	FROM product AS p
    	INNER JOIN book AS bk
    	on p.id = bk.product_id
    	

     

    How can I "shift" things so my final query shows the columns:

    id, sku, name, title

    where the first table would fill out "name" and have blank "title" rows, and the second query would have blank "name" rows but filled out "title" rows??

     

  20. Here is a little more of what (I think) I'm trying to do...

    	PRODUCT (parent)
    	- id
    	- product_type_code
    	- sku
    	

     

    	BOOK (subtype)
    	- id
    	- product_type_code
    	- title
    	- thumbnail
    	

     

    	SHIRT (subtype)
    	- id
    	- product_type_code
    	- name
    	- thumbnail
    	

     

    I am trying to build a query that can be used to display all items in a person's shopping cart.

    Because I have disparate subtypes, some things won't match up - which is why i decided to create subtypes in the first place - but things like a product's name, description, and thumbnail should be universal for any subtypes.

     

    My cart looks like this...

    	SHOPPING_CART
    	- id
    	- member_id
    	- product_id
    	- cart_price
    	- quantity
    	

     

    But in the shopping cart I display to the user, I also need some fields from the subtype tables.  (For example, a BOOK has a "title" whereas a SHIRT has a "name".

     

    So how can I create a query so I can get results like this...

    	- id
    	- product_type_code
    	- sku
    	- book_title OR shirt_name
    	- book_description OR shirt_description
        - thumbnail
    	- price
    	- quantity
    	

     

     

    Hopefully that makes sense!

     

  21. My database has parent Product table and multiple sub-type tables like Books, Tshirts, Gear, etc.

    I need a way to display everything in the Product catalog including details only found in the sub-type tables.

    How do I do that?

    When I tried multiple INNER JOINS my query didn't return any records.

    Maybe I need to use a UNION?

     

×
×
  • 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.