Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Dynamically generating switch / PHP

Name: Anonymous 2012-08-14 0:02

Hey,

At the moment I'm creating something like a CMS (Content Managment System) in PHP.

I have a switch - clause to go through all the index.php?p=[something] - links, like 20 cases in the index.php

Other CMS I know solve that problem via redirecting index.php?p=x automatically x.php (or automatically calling template for x), but I want to go some other way.

Is there anway way to create a switch-clause dynamically via a CSV File / MySQL Database with eval?

I already tried it, but I failed.

Any ideas?

Name: Anonymous 2012-08-14 0:10

The world certainly needs a CMS written in PHP. There's a real dearth of projects in that niche.

Name: Anonymous 2012-08-14 0:48

There's a real dearth of projects IN MY ANUS!

Name: Anonymous 2012-08-14 2:44

You want to use eval() ? Good luck on that. When you'll be finished, could you give me the URL of your website, just for ``testing'' purposes ? Thank you.

Name: Anonymous 2012-08-14 2:49

You've got to be fucking kidding me

Name: Anonymous 2012-08-14 3:24

Anus Management System

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2012-08-14 4:51

The usual way is to do your redirect is to store the destination in the database so you'd use a query like this:
select dest from redir where id = ?

But you can query all the links from the database and generate a switch statement, although I'm not so sure why you'd specifically need that. (If you don't want to hit the database on every request, then you'd need to persist the generated PHP too.)

Name: Anonymous 2012-08-14 6:36

PHP arrays are maps.

Name: Anonymous 2012-08-14 16:55

/Le kebab/ is this way, please.

Don't change these.
Name: Email:
Entire Thread Thread List