Welcome Guest, Not a member yet? Register   Sign In
Add form to database page content!?
#1

[eluser]Sven Delle[/eluser]
I've got this database driven website (who hasn't?).

All page content is pulled from the database based on an uri segment (id).

Now, I'd like to add a contact form to the contact page (let's say it has an id of 4).

The only way I see to fix this problem, is to make a check in the controller if the id is 4 and then add the form through code in the controller. But this also tells me that that would be close to impossible to manage for like 2,340,579 different random pages (think Content Management System).

Are there any CLEVER way of adding a form (or anything other than text and images for that matter) to ANY page by ... erm, tickboxes or whatever. Hope you get the point of what I'm trying to achieve.
#2

[eluser]solid9[/eluser]
It's easy if your site is in template.
If not then you should recreate it.

Because you can just throw the "form" into view through $data.
#3

[eluser]Sven Delle[/eluser]
Good point!

But you would still on page level have to make some kind of check. I'd like to have the information connected to the page content actually i the database.

Has anyone seen some clever way to manage ALL content in ONE place?
#4

[eluser]Mauricio de Abreu Antunes[/eluser]
1 - Create templates.
2 - "Include" them using your segment.

Does it work fine?

If not, you can map your forms in your database.
For example:
Insert news form - insert_news_form (view) - news/insert (controller)
You can map this "insert" for a select in your database, retrieving fields from News table.

IMHO this is not sooo good. :-)




Theme © iAndrew 2016 - Forum software by © MyBB