Override theme function for menu callback What I am looking for: I have a custom node link which, when clicked, displays a custom HTML content (option selections) in a lightbox. I need to pass an argument to the HTML content to generate the HTML code. 

What I did: I created a menu callback with one argument, and a template file for this "page" that does the processing and display the HTML content in the lightbox. I guess it's a little bit overkill and it takes quite some time for the whole render to be computed. 

Would it be better (faster) to override the render with theme function? If that's the preferred solution, how to do? Create a my_theme_page() function in template.php file?

Or can I generate the HTML in the callback function? 

Any help would be appreciated.
After a lot of googling, I found a nice solution to my problem. 

First, one needs to register its menu with callback (in a custom module): 

function MY_CUSTOM_MODULE_menu() {
  $items = array();
  $items['my_link_url_path/%'] = array(
    'title' =&gt; 'content title', 
    'page callback' =&gt; 'MY_PAGE_CALLBACK',
    'page arguments' =&gt; array(1),
    'access callback' =&gt; TRUE,
    'type' =&gt; MENU_CALLBACK,
   );
   return $items;
}


Then the HTML content you want to be in the lightbox has to be printed in the callback function (you can define this function in your custom module file) as follow:

function MY_PAGE_CALLBACK($MY_PASSED_ARGUMENT = NULL) {
  print 'This is my HTML content displayed in the lightbox: Arg = ' . $MY_PASSED_ARGUMENT ; 
}


The trick comes from the fact that you do not return, but print directly the output. No theme layers will be processed. 

Just add your link somewhere (with the lightmodal rel attribute if you are using Lightbox2 (http://drupal.org/project/lightbox2): 

&lt;a href="/my_link_url_path/345" rel="lightmodal"&gt;Click me&lt;/a&gt;


This will display 'This is my HTML content displayed in the lightbox: Arg = 345' in a lightbox. 

Note: don't forget to empty the cache when changing your menus...