By daddydo on
Using drupal 6.4
What I want to achieve: having a PHP output in a block. I stored a PHP script in sites/all/default/files. This PHP script generates a html output. In admin/build/block I add a block and typed include('.all/default/files/myfile.php'); The site is in all/themes/mysite. When I saved the block the website crashed, got a Forbidden message and I had to delete the block from DB.
It should be possible to have this output in a block, but obviously I don't follow the right steps. How should this be done?
Comments
I assume the problem is in
I assume the problem is in the path to your php file:
.all/default/files/myfile.phpcan never be right, it should at least be./all/default/files/myfile.php. But even then: your site is not in all/themes/mysite; that's just where your theme is. Your site is, put simply, in the site root '/'. I think you should try to include /sites/all/default/files/myfile.php (note the starting slash).You may also want to wrap the include in an if statement that checks if the file exists at all, to prevent crashes:
yup
good advice x3.
.dan.
if you are asking a question you think should be documented, please provide a link to the handbook where you think the answer should be found.
| http://www.coders.co.nz/ |
.dan. is the New Zealand Drupal Developer working on Government Web Standards
marc - problem solved thanks
marc - problem solved thanks to your suggestion.
dman - you're right. next time better!
BTW Is there a way to call a certain block in a sidebar using URL?
>> BTW Is there a way to
>> BTW Is there a way to call a certain block in a sidebar using URL?
What do you mean? Blocks don't have a url, you can't call them by url. Blocks are placed in a region. Displaying of a block can depend on the url of the page it is on.
you might be looking for
you might be looking for (drupal 5, the 'delta' indexes changed in D6)
eg $modulename ='user', $delta='1' for the login block.
... but maybe you mean something else.
.dan.
if you are asking a question you think should be documented, please provide a link to the handbook where you think the answer should be found.
| http://www.coders.co.nz/ |
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Something went wrong
Something went wrong posting...Why edit is on?
I want to have a nice little
I want to have a nice little contact form in a block, that is always there no matter what node number is opened and when 'send' button is pressed, the current node stays open. Most contact forms have a error page that jumps out of the block, unless you have pointed it to it's URL page where it is originally placed (think of a separate 'contact-page'), but in this case there is not such a page. mmmm...., complicated. I found a script, that does this and cannot change it's behaviour. Now maybe there's a module for d6 but couldn't find it. The point is that the error page should stay in the block (or better the errors are not send via a new page), and the correct filled in fields should be kept. And of course no contact form without captcha and other security in its place. I know, asking too much......
Can you remove a post?
Can you remove a erradic post?
Ask the
Ask the webmasters.
http://drupal.org/node/add/project-issue/webmasters
Hi marc, did you read my
Hi marc, did you read my post about the 'nice little contact form in a block'?
Contact Form in a block possible?
d6.4 installed.
I want to have a nice little contact form in a block.
I found something like that, but didn't match d6.
Maybe a module does exist for d6, but couldn't find it.
It sounds like someting you
It sounds like someting you should do with AJAX, I don't know how to do it.