Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2012
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    A problem in OOP

    Hello! i'm newer in OOP and I have made an website in PHP classic. I want to modify the website and to use OOP.

    For example in .htaccess I have

    Code:
    RewriteRule ^index.html index.php [N]
    
    RewriteRule ^([a-zA-Z0-9-_]+).html$ index.php?pagina=$1 [L,QSA]
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+).html$ index.php?pagina=$1&poll=$2 [L,QSA]
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+)/([0-9-_]+)$ index.php?pagina=$1&paginaphoto=$2&id_photo=$3  [L,QSA]
    
    #RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+)/([0-9-_]+)/?.jpg$ index.php?pagina=$1&paginaphoto=$2&id_photo=$3 [L,QSA]
    in index.php I have

    Code:
    if ($_GET['pagina']=='katarina')
        {
          if ($_GET['paginaphoto'] == '')
          {
            echo '<td valign="top"    style="border-left: 1px solid #cccccc; padding: 2px;">';
            include('includes/katarina.php');
          }
          elseif ($_GET['paginaphoto'] == 'photo')
          {
            echo '<td valign="top"   style="border-left: 1px solid #cccccc; padding: 2px; border-right: 1px solid #cccccc; padding: 2px;">';
            include('includes/photo.php');
          }
          elseif (!empty($_GET['paginaphoto']) and $_GET['paginaphoto'] != 'photo')
          {
            
            echo '<META HTTP-EQUIV="Refresh" Content="0; URL=/katarina/index.html">';
          exit;
          }
        }
    so in index.php I used the method GET to load the page katarina.php

    My problem is how could I change index.php if I would want to use OOP? I need some suggestions of you... Or maybe a good video on youtube or a good article on web.

    Thank you very much!

  • #2
    Regular Coder Linux_Sage's Avatar
    Join Date
    Mar 2014
    Location
    Sterling,VA
    Posts
    106
    Thanks
    0
    Thanked 10 Times in 10 Posts
    What do you mean 'use OOP'? What is your goal? There's no point in using OOP for OOP's sake if you aren't trying to solve something in particular or have a very good reason for doing so.

  • #3
    New Coder
    Join Date
    Feb 2012
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    so, is it possible to modify my website and to use OOP?

  • #4
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,342
    Thanks
    13
    Thanked 349 Times in 345 Posts
    Quote Originally Posted by milanello72 View Post
    My problem is how could I change index.php if I would want to use OOP? I need some suggestions of you...
    start using a templating engine. that will introduce enough OOP for you.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •