0
votes

I am very very new to Drupal 7 and am simply trying to create a new page that uses a dedicated .php page along with a custom page.tpl.php file.

Within the CMS of Drupal after creating a new "Page" within the content tab... I see this text under the Body textfield:

Use the syntax [[file-name.php]] to use the contents of a file in the theme directory.

My question is, how do I make this work? I have a products.php file within my theme directory, I have created the new Page called "Products" within the CMS, I have put [[products.php]] within the Body textfield... but no luck.

Can someone please tell me how to make Drupal 7 pull my dedicated products.php so that the CMS will pull the file contents into the Body textfield?

Thanks

2
What do you have inside products.php ?!Muhammad Reda

2 Answers

1
votes

You could try creating a very simple module and put your custom php code in a custom php function like this one:

    <?php



    function yourmodule_menu() 
    {
        $items['path_to_your_page'] = array( # url and menu link placement for this page
            'page callback' => '_your_custom_php_function', # function that returns or echos pages content
            'access callback' => TRUE, # no restrictions on access rights
            'type' => MENU_NORMAL_ITEM, # this type creates normal menu item
        );

        return $items;
    }

    function _your_custom_php_function(){
        echo 'test';
    }
0
votes

I had the products.php within a folder of the theme. I had to specify [[pages/products.php]] instead of just [[products.php]].. thanks!