I have googled my question many times but i cant find a good solution. I want to add a php page into drupal.
Is there a way to call(perhaps a menu link) a php page within the existing drupal(template) with an include or something?
From http://drupal.org/node/1046700
Drupal 7 Core contains a module called "PHP filter". A fresh install
of Drupal 7 has this module disabled by default. We need to enable it.
Any page or block text area can include PHP code in drupal, if the PHP filter is enabled and the user has permission to use it.
If you want to add a link to a PHP file completely outside of the drupal CMS, you can do so too.
example)
<a href="http://yoursite.com/your/physical/path/to/a/php/file.php">
external PHP file
</a>
unable to understand the question completely ... is the PHP page to be used within a module?? perhaps use 'file' and 'file path' in the hook_menu of your module to include the page .... or if its in block level would suggest the previous answer from #DownDown ....
Related
I have a php page that is just a page I am linking to, from index.php.
When I try to use jdoc include to place the module, it doesn't work.
Should I do something special to make this php page a part of the Joomla template? Should I make it an article? Or is there just another way to load this module?
You can use this extension https://extensions.joomla.org/extension/jumi/ and on it you can put the path of your php file.
I'm working with the Webform module of Drupal 7 and I'm trying to modify the hook_webform_submission_presave in the webform.api.php , but it seems that the module is not using this file because I've made modifications but doesn't change anything.
Do I have to say to Drupal in any place to use this file? Or what do I have to do?
First, I hope that you know that you shouldn't change module files directly, but to add hook function to your module and change that "hook" at beginning of function name with your module machine name.
Second, you have to clear all the caches so Drupal will re-scan your module and figure out that there is new hook function and start using it.
So, you have to create your own module first:
https://www.drupal.org/developing/modules/7
Don't be scared - It's just a folder with an info file describing your module and module file it self (in minimal case).
Then, if your module is called "anna" you should create a function inside your module file and name it:
anna_webform_submissions_presave()
And clear the cache - after that Drupal should start calling your hook function.
Modules don't use their .api.php files. These file are there for documentation purpose. That's the standard way for documenting hook definitions.
I have been cracking my head about this for two days on. I inherited some magento 1.9 Multi vendor website and just need to bolden some text on the customer create account field. I have searched every where in my template directory Customer/form/register.phtml and Persitent/form/register.phtml yet I am not successfully able to identify the line that prints
'wants to become a vendor?'
Here is a link to the form please.
http://store.min-trade.com/index.php/customer/account/create/
Could someone point me in the right direction. I pretty much understand the project structure of Magento I do believe. Please help!
Are you sure you are looking in the correct template folder?
You are using the rwd/default template, so have a look here;
app/design/frontend/rwd/default/template/persistent/customer/form/register.phtml
If there isn't a file called register.phtml in that location, then Magento will fall back to the base folder, so try;
app/design/frontend/base/default/template/persistent/customer/form/register.phtml
If you still cannot find the text, it could be a custom login form using another template. Login to your server with ssh/putty and run this command;
grep -nr 'Wants to become a Vendor?' /path/to/magento/*
Just make sure you set the correct path.
You can easily check by enabling path hints from magento admin.
If you dont know how to enable file path hint then refer this link enter link description here
second thing that if you have installed any vendor extension then register form will be displayed from that module.
You can also install this path hint module for check file.
I'm coding a form in Drupal 7, and I want to 'include' a php file that adds my DB connection variables to my code.
I've tested my code in several ways, and I'm sure that the 'include' makes me get a WSOD when I run Cron in my site.
I've Googled about this and I tried:
include("/sites/all/libraries/php/connection.inc");
include("./sites/all/libraries/php/connection.inc");
include"./sites/all/libraries/php/connection.inc";
I also tried the above with '.php' extension.
And my last try:
define('__ROOT__', dirname(dirname(__FILE__)));
include(__ROOT__.'/sites/all/libraries/php/connection.inc');
Sometimes I get a WSOD when trying to run Cron, and sometimes my page styles get broken when I submit a form.
What is the correct way to include a PHP file manually in Drupal? Note that I don't want to use the 'Drupal way' to do this or to use the webform module. I want to code it manually with PHP.
The libraries directory should only be used to store files shipped as a library through the libraries module (see here https://drupal.org/project/libraries).
For both examples lets assume library.inc is our file and relative_path_to is the relative path based on the module directory to our library.inc file.
To just include a file you can use:
require(drupal_get_path('module', 'module_name') . '/relative_path_to/library.inc');
And to do it the Drupal way (https://api.drupal.org/api/drupal/includes!module.inc/function/module_load_include/7):
module_load_include('inc', 'module_name', '/relative_path_to/library');
Cheers,
j
Try this ways
1) require 'includes/iso.inc';
2) include_once 'includes/iso.inc';
3) include ('includes/iso.inc');
OR Drupal Ways
include_once DRUPAL_ROOT . '/includes/iso.inc';
In my opinion these are correct Drupal (7) ways to include code:
module_load_include(); function - Drupal API documentation - to include any PHP files from within your or other modules where needed,
files[] = ... in your_module.info file to autoload include classes and interfaces within your own module - Writing .info file documentation.
Libraries module provides it's own way to include external PHP files from the libraries.
The second answer is the correct "Drupal way". The one that was accepted as the answer has many potential pitfalls if locations of things change. Using drupal_get_path is the best way. This is also especially true if you are trying to include a file that may not be fully bootstrapped during a module update hook.
I would like to include a PHP program into a Joomla! article, this program calls different PHP files that are used to display what I want, I have tried to install different Plugins such as Jumi, directPHP and others, but I keep getting the following error:
Application raised an exception class EDatabaseError with message 'Cannot connect to database server:mysql error: [0: Connection error to server '' with user ''] in CONNECT(, '', '**', )
'
The program runs fine Standalone, however it does not work when I'm running it on Joomla.
The connection parameters are obtained from an include "config.php" but it seems that they won't get the includes from the included PHP file.
Also when I try to include a menu I have made, which works standalone, redirects me to the index.php of Joomla! root dir.
Thanks.
I've done things similar to this, but have had to install a couple of extensions to get them to work.
First, i use the jce WYSIWYG.
then installed place anywhere (which lets you place modules inside articles)
create a new module, type=Custom HTML
code your php there...
I know this isn't exactly what you're describing, but it's the closest i've come in my experience.
If it doesn't work right away, be sure to check for the settings withing the JCE WYSIWYG so it's not breaking your php.
hope this helps!
Try to use 'Flexi Custom Code' extension is a good one
check it: http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules/15251
Its a module extension which you can use with 'module anywhere' to place in the 'content area'(article). For calling different php file you can use the php include or required once code
Please feel free to ask if any doubts are there....implementing this