Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Content include on $p var VS. seperate pages

Engaged ,
May 23, 2008 May 23, 2008
I am just starting a new site ( www.freecrm.zymichost.com in php with back end MySQL data

I have been advised that you should only have one main index.php file and then include main content based on the variable posted.

e.g.

if $p == "Register" then link /index.php?p=Register
elseif $p=="Login" then link /index.php?p=Login
else link /index.php?Home

blah de blah - you get the message.

The page I have has a header, main content and footer include - all of which work great but I am having doubts that further down the line, I will start to get problems with passing additional variables.

Is this method recommended or should I create standard seperate pages based on a template?

In addition, I have a "sniffer" script, which captures visitor data and will, eventually, insert those details into a history database. This will then be viewable by potentail advertisers to validate visitor count.

My problem with this is that if I use the first method of content include, I will have to capture the variable extension (i.e. after ?p=blah&cusid=1456374) to obtain which page is visited but it will also capture more personal information passed in the URL (such as cusid...)

Again, I think that if I create sepearate pages, I can leave out the variable capture from the URL.

Does any of this make sense?

Any opinions would be greatly appreciated.
TOPICS
Server side applications
501
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 24, 2008 May 24, 2008
.oO(RichardODreamweaver)

>I am just starting a new site ( http://www.freecrm.zymichost.com in php with
>back end MySQL data
>
> I have been advised that you should only have one main index.php file and then
>include main content based on the variable posted.

It's one possible way, but definitely not the only one. So IMHO it's a
rather bad advice.

> e.g.
>
> if $p == "Register" then link /index.php?p=Register
> elseif $p=="Login" then link /index.php?p=Login
> else link /index.php?Home

And ...
Translate
LEGEND ,
May 24, 2008 May 24, 2008
.oO(RichardODreamweaver)

>I am just starting a new site ( http://www.freecrm.zymichost.com in php with
>back end MySQL data
>
> I have been advised that you should only have one main index.php file and then
>include main content based on the variable posted.

It's one possible way, but definitely not the only one. So IMHO it's a
rather bad advice.

> e.g.
>
> if $p == "Register" then link /index.php?p=Register
> elseif $p=="Login" then link /index.php?p=Login
> else link /index.php?Home

And bad code too. If you want to go that route, use a lookup table.

> blah de blah - you get the message.
>
> The page I have has a header, main content and footer include - all of which
>work great but I am having doubts that further down the line, I will start to
>get problems with passing additional variables.
>
> Is this method recommended or should I create standard seperate pages based on
>a template?

I would not recommend it unless you know exactly what you're doing. It
can make maintenance more complicated and leads to really ugly and user-
unfriendly URLs. You don't want that.

Additionally you won't get proper access statistics from such a setup,
because for a logfile analyzer there's only one page.

Both problems can be solved, but that requires even more work. So for
now separate pages would be the better choice.

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 24, 2008 May 24, 2008
Micha - thank you - this confirms what I thought and I'm glad I haven't gone further down this route.

As you have supplied valuable advise before, I will follow it now...

Here's to seperates!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 24, 2008 May 24, 2008
LATEST
.oO(RichardODreamweaver)

>Micha - thank you - this confirms what I thought and I'm glad I haven't
>gone further down this route.
>
>As you have supplied valuable advise before, I will follow it now...
>
>Here's to seperates!

You're welcome.

Micha
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines