I am learning Drupal 7 for my new project.
Here is what I want to do
- create a new content type called ‘video’
- create a new module called ‘video’
- make http://domain.com/video accessible.
- when a user access /video, then execute a query that queries video rows from video table (created by ‘video’ content type’), then display queries with a custom template.
I have learned how to do #1 ~ #3, but I am a little bit confused with #4.
let’s assume that my custom template’s filename is ‘video.tpl.php’
in the video.tpl.php, do I write php functions to query video rows?
I don’t think that is a good practice. Instead, I want to write a module and call a function in the module when the video.tpl.php is loaded.
How do I do it?
You should use views