Jump to content

Site Structure


Love2c0de
Go to solution Solved by Love2c0de,

Recommended Posts

Good evening,

 

My client wants sub menus within the navigation like the format below:

        Home
        
 
        Avaliable Rentals
        
 
        Property Owner
             Owner Services
             owner specials
             Owner FAQ
             Owner Contact
             
        About us
            Who we are
            what we do
            our history
            
         Our services
              Owner Services
              Tenant Services
              
         About Florida
                Florida NC
                Florida activites
                Florida Schools
                Florida Parks and recreation
                Florida restraunts
                Florida Entertainment
                Florida health care
              
  
        HOA Management
             
             
        Contact US
 

I'm going to do a breadcrumb effect and they also want the URL to look like: www.theirsite.com/About/FloridaHealthCare so I'm going to rewrite the URL.

 

What is the best way to store my HTML template files (the sub level links above)? I've got a main directory where they are called 'content'. Within that should I create the other directories such as 'About', 'PropertyOwner', 'Services' etc and then have my actual template files within the relative directories?

 

Or should I just keep all template files in one main folder and write the sub directory via code?

 

I'm thinking to create the directories within 'content' and put the files in the relevant ones as it would automatically write that part of the URL for me but I want to know what the standard is.

 

Thanks for your time.

 

Kind regards,

 

L2c.

Edited by Love2c0de
Link to comment
Share on other sites

There's no real best way.  There are conventions, but they're used mostly because they're convenient.

 

With MVC sites, you'll find views (page templates) split by controller.  So, you'll have something like (with the filesystem):

/path/to/project/resources/views/<controller name>/<controller method template>

So, you could have something like:

/path/to/project/resources/views/AboutUs/who_we_are.tpl

But, again, there's no right/correct/best answer aside from whatever makes the most sense to you, and is easy to use.

Edited by KevinM1
Link to comment
Share on other sites

Good afternoon,

 

Following on, I've got the site nearly made now.

 

The same as above but I have put all content template files into one main folder. 

 

I'm not sure how I am going to target the pages to know which 'directory' to add.

 

For example 'Who We Are' needs to be written as www.mysite.com/About/Who-We-Are but how am I going to target that dynamically for the other pages?

 

I thought about hardcoding it in the anchor tags such as:

<ul>
     <li><a href="#">About Us</a>
           <ul>
                 <li><a href="./About/Who-We-Are">Who we are</a></li>
                 //etc
                 //etc
           <ul>
     </li>
</ul>

Is this something I can control with .htaccess? If so I still need a way to determine which value to put in place of 'About' as I have 2 other links with a sublevel menu. 

 

It's seeming easier to just put the individual related template files into the corresponding directory within my main template directory such as:

[content]
       [about]
               who-we-are.tpl
               our history.tpl
       [activities]
               nc-culture.tpl
               nc-entertainment.tpl
               nc-sports-and-recreation.tpl
       etc
    
      etc

That way I just need to control the filename part of the url with .htaccess.

 

What do you guys think?

 

Kind regards,

 

L2c.

Edited by Love2c0de
Link to comment
Share on other sites

Ok, so what I've done is wrote the link as such:

 

 

<a href="./PropertyOwners/owner-specials">Owner Specials</a>

 

With my .htaccess looking like:

 

RewriteEngine on
RewriteRule ^/?([a-zA-Z-]+)$ index.php?page=$1 [L,QSA]
RewriteRule ^([a-zA-Z-]+)/([a-zA-Z]+)/?$ index.php?page=$1&category=$2 [L]

 

Now, this works perfectly for my links which are top-level links such as:

 

<a href="./contact">Contact</a>

 

but when I try adding the extra $_GET variable, it doesn't work - I get a 404 error.

 

I've tried changing the second RewriteRule in my .htaccess so that the 'page' $_GET variable is at the very end of the URL with 'category' being the first $_GET in the URL - followed by the filename.

 

Really at a loss.

 

Is it because of the QSA - append flag?

 

Thanks for your time.

 

Kind regards,

 

L2c. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.