Sunday, 4 March 2012

Break out from Drupal (from the inside)

Quick post: sometimes you (or someone you are working with) may need to break out from Drupal, and generate a special page perhaps based on some existing php code that has been adapted or similar, but that is now pulling data from drupal.

The following code is a brief example of an approach that allows foo.php (in this example) to have full access to any to any variables you may create from querying Drupal and perhaps pick up arguments from the url. foo.php in this case is now responsible for generating the page output.

The use of drupal_exit(); in this case still allow modules to implement exit hooks.


/**
 * Implements hook_menu()
 */
function my_module_menu() {
 
  $items = array();
 
  $items['foo'] = array(
    'title' => t("Foo"),
    'type' => MENU_NORMAL_ITEM,
    'page callback' => 'my_module_foo_page',
    'page arguments' => array(),
  );
 
  return $items;
}

/**
 * My module foo page callback
 */
function my_module_foo_page($arg1 = false, $arg2 = false, $arg3 = false) {
  
  //do some regular Drupal stuff here, populate some variable etc. 

  drupal_add_http_header('Content-Type','text/html');
  include_once('foo.php');
  drupal_exit();
}

13 comments:

Anonymous said...

Red Robert Griffin III Youth Jersey axiotakix
Red Doug Martin Kids Jersey axiotakix
Eli Manning Blue Jersey axiotakix
http://www.nikebroncosnflshop.com

Anonymous said...

Women's Robert Griffin III Jersey axiotakix
Marshawn Lynch Jersey Women's axiotakix
Aaron Rodgers Mens Jersey axiotakix
http://www.nikecowboysnflstore.com

Anonymous said...

axotomarvex Coby Fleener Jersey
nike T.Y. Hilton jersey
Andrew Luck elite jersey
UnmannaSmurce

Anonymous said...

Nike Bobby Wagner Jersey
James Harrison Youth Jersey
Sidney Rice White Jersey
drydayoutraro

Anonymous said...

Troy Polamalu Youth Jersey
Jonathan Dwyer Womens Jersey
Marshawn Lynch Jersey
drydayoutraro

Anonymous said...

ZesNiclesex Santana Moss Jersey
www.officialnikeredskinsshop.com/redskins_robert_griffin_iii_womens_jersey-c-9_35.html
Eric Decker Womens Jersey
nutWhororog

Anonymous said...

Biansioni Rob Gronkowski Jersey Antonio Brown Jersey Eli Manning Jersey

Anonymous said...

Tapi kesemuanya akan gagal total dalam mencapai tujuan dasarnya apabila bahasa yang dipergunakan mengandung kesalahan The Hartford Whalers' NHL Jerseys Plus, with the support the Flyer fans give their team, they will have the house rocking every game and the energy they bring to their players, unmatched by other buildings in the league with maybe the exception of Montreal and Chicago Louis Cardinals 20/1 Tampa Bay Rays 20/1 Texas Rangers 18/1 Toronto Blue Jays 50/1 Washington Nationals 80/1 Talk about getting no respect, the San Francisco Giants are the Rodney Dangerfield of baseball, the defending champions are currently listed at 14-1 odds to win the World Series this season After the first phase (normally a written test) not many people get rejected, the real shedding happens during the interview New York giants of this year's rookie Prince Amukamara in training and on Sunday he left foot fractures can only walk on crutches It was set up in 1932 in Boston, earlier called the Boston Brave Team, and at that time the boss of the team was George Preston Marshall
am I betting because I just want action on the game right now or am I serious about making money on NFL football odds in the long run? The number one rule about making money at sports betting; know how much money you can afford to bet on each game This does make sense because it is unthinkable for any other arrangement to be usedSetting it up is uncomplicated within your dashboard If you are a die hard NFL fan, you dread being seen without NFL jerseys Sainz has researched the experience in your Twitter account Also students may qualify to work part time

Cheap Baseball Jerseys
Nike NFL Jerseys Wholesale
Cheap Ncaa Jerseys

Anonymous said...

After we go through the purpose of the saying love, installing comparison to its a loving marriage having a further, nonetheless being a sensation which is engendered should you have miltchmonkey an improved connection on your own also -- or even like a sensation of larger oneness with the fam or simply humanity : that becomes substantially more superior that every one any individual is looking to get in daily life is definitely love.

Anonymous said...

Cost-free Proxy Servers are utilized for anonymous searching. Most typical utilization of totally free proxy server is to bypass the university/place of work or any other place's safety limitations and obtain unrestricted sites. But [url=http://www.scrapestuff.com/scrapebox-resources ]proxies www.yourprivateproxy.com [/url] servers really should be utilized with caution. If employed with no protection actions, it can end result in big decline as when compared to edge of browsing the internet anonymously. There are two ways via which you can cover your identification (your IP address) when surfing the net. Initial and the most cheap way is to use free of charge proxy server. There are many windows and linux proxy web sites offered on the internet which allows you use their solutions cost-free of cost. The other solution for hiding your identity is to use compensated application. The IP hiding computer software, alterations your IP deal with constantly to permit you browse web anonymously.

There are number of important items you need to have to maintain in mind when using cost-free proxy servers.

1.) View out for your protection

Do not give out any sensitive information these kinds of as your login particulars or credit card data when utilizing distinct proxy servers due to the fact when you use free proxy server, all the information you give on any internet site is first sent to free proxy server and then to the site server. So all the details go through the totally free proxy server and most of the time it is unencrypted, exposing your delicate info for prospective misuse.

Paid application are significantly far better in conditions of stability. There systems are designed to conceal your IP and then discard all your data without any human involvement.

2.) Stability and Availability

There are a lot of totally free proxy server web sites but most of them are not steady and are not obtainable each and every time you pay a visit to them. This difficulty is not extremely considerable with compensated computer software.

three.) Pace of Browsing

When you use any proxy server for hiding your IP, you can feel the gradual pace of searching instantaneously. Though there are good web sites offered for anonymous browsing but they are really challenging to discover. Also, velocity is not regular it is dependent mainly on load on their servers. At times you do get excellent browsing speed but it's not steady. Once again, compensated application for hiding IP are a lot much better at searching pace. As they charge for their services, they make sure that the person expertise is greater and you do not get gradual pace although browsing the world wide web by means of their computer software.

They are also excellent when you uncover a good quality a single that masks your region of origin. When searching for a Online Proxy make sure it has Java set up so you can view films. As you can at times have your place of origin cloaked but if java does not function it is not significantly use.

Anonymous said...

Hmm is anyοne else encоuntering problemѕ with the images on
this blοg loаԁing? I'm trying to find out if its a problem on my end or if it's
the blοg. Anу feеdback would be greatly аppreciated.


my page: cheap car insurance michigan young drivers

Anonymous said...

Hello, i bеlieve that i noticеd you ѵіsіtеԁ my wеb site so i came to гetuгn the favοr?
.I'm trying to to find issues to improve my web site!I suppose its good enough to use a few of your concepts!!

Feel free to visit my web site pure green coffee extract

Anonymous said...

Hi mates, how is everything, anԁ what you wish for to
say conceгning this pіece οf writing, in
my viеw itѕ genuіnеly remarκable dеsigned fог
me.

Also viѕit my webрagе green coffee extract