Hello,
I'm a little stuck. Is there a simple and straightforward solution to add a simple page to your site in a custom path?
I want to build a page in the path /company that will display some information, a login box and in the end links to a registration page.
What i am struggling with now, is that i would like to know how to tell drupal that my "company.tpl.php" is available under the path "/company".
I know i could create a views page, a panels page or create a content of type "page" and this way use the template suggestions. But all that seems to be a little over-dressed for simply hooking an empty page into the drupal paths.
It's not that i couldn't get it done but the ways described seem a little clumsy because i would simply create a dummy view, a dummy panel or a dummy content to let the magic happen in the template file anyway. It doesn't feel right.
Am i missing something here?
Please enlighten me.
Thx
Comments
Use page
Use Page content type, leave it blank, use the Path module to set the link where you want it, then use a tpl file that is specific to the blank node you just created. Use the following book page to make that happen:
http://drupal.org/node/136647
Tony
Anthony Pero
Project Lead
Virtuosic Media
http://www.virtuosic.me/
_
The simplest way is to create a node of content type 'page' and give it a URL alias of 'company'. Then, using the core provided template suggestions, just name the template file page-node-#.tpl.php (where # is the nid of the page you created) and it will automatically be detected and used (you may have to clear the cache). That's not over-dressed-- that's the way it's meant to be done. If you want to provide your own template suggestions in addition to core, see Working with template suggestions.
Ok, if that's the way... I
Ok, if that's the way...
I just thought creating a dummy (empty content) just to have a template file respond to a path would not be the right thing.
_
Why would the page be empty? In your op you specify what's going on the page...
the database entry (nodetype
the database entry (nodetype page) would be empty
_
Sorry but I'm still not getting why it's empty:
Because if it truly is empty, then there would be other ways to do it.
I create a node of type page
I create a node of type page and give it a custom path so the template file I create for that node would be displayed.
Since all content is being created in the template file, the node in the database does not need to have content. The $content variable is not being used in the tpl.
I do this to have the template file show up when the path is requested and because I don't see any other way to relate the path to a template file.
node 123 (type page) -> path /company -> show page-node-123.tpl.php
_
obviously, you can do whatever you want, but this is not the 'drupal' way-- for the most part content should not reside in template files.
I totally understand. That's
I totally understand. That's what a CMS is made for.
But in this case it is a static site, text mixed up with images laid out nicely with html and css which then would have to reside in the database. Since end users will have access to it, i kind of feel the urge to take that away from them.
And editing pure html to put it in a database also feels not too right.