A Poor Coder's Devel Themer Port for Drupal 5

Ethan's picture

Let me start by saying I’m not proud of this, it is one of those awful awful hacks which I should be ashamed of and appalled that I would even consider, one of those hideous violations of every coding standard known to good coders throughout the world.

What is this horrid, monstrous bit of code hackery I’m referring to? It’s a simple hack to the theme function which provides a very rudimentary version of some of the theme-level information so elegantly and profoundly usefully exposed by Moshe Weitzman’s Devel Themer module. For various reasons, this hack actually isn’t that egregious; for one it is ONLY FOR USE ON DEVELOPMENT SITES, and therefore does not all into that more loathsome category of coding dark secrets which are injected into codebases in the 11th hour to make Drupal conform to non-Drupal-tuned functional specifications. In addition, the hack allows custom processing of theme output to be included in the info dump for themed blocks, and therefore makes incredibly arduous tasks like finding the source of a missing </div> tag a great deal less awful. Let’s face it (with relish): sometimes hacking core is just the best way to debug difficult problems.

So, enough stalling, just what is this horrible, awful, shameful hack I’ve devised. Well, it’s anticlimactically simple, actually. Just insert the following code into the function theme() declaration in theme.inc just above the return call_user_func_array($functions[$function], $args) call:

<?php  
/* BEGIN: poor coders devel themer hack to determine where content is being generated */    
  
if (is_string($rtn)) {
    
$odivs substr_count($rtn'&lt;div');
    
$cdivs substr_count($rtn'&lt;/div');
    
$ne_divs = ($odivs!=$cdivs)?" NE_DIV_TAGS":'';
    return 
"&lt;div class=\"THEMER-DUMP\" style=\"display:none\"&gt;\nSTART: " .
      
$functions[$function] . " ($odivs,$cdivs)$ne_divs\n&lt;/div&gt;" $rtn 
      
"&lt;div class=\"THEMER-DUMP\" style=\"display:none\"&gt;\nEND: " 
      
$functions[$function]    . " ($odivs,$cdivs)\n&lt;/div&gt;";
  } else {
    return 
$rtn;
  }
  
/* END: poor coders devel themer */
?>

This code is tuned for finding unclosed div tags: at the end of every themer output dump is a count of open and close div tags. This was what I needed at the time, but there is no reason why additional data cannot be included. The code should be commented out except when needed and NEVER PUT ON PRODUCTION WEB SITES, but hopefully will be useful to some people (at least until a real port of the Devel Themer functions emerges for Drupal 5).

Comments

Sohbet's picture

Thanks a lot for this. I like it.

Merkl's picture

Yeah, it is a bit dirt, but i need this hack :-)
Thanks!

sohbet's picture

Thanks a lot u kaptiniz benden gidiyonuz mk.: )

Hank's picture

Give please. The toughest thing about success is that you've got to keep on being a success. Talent is only a starting point in this business. You've got to keep on working that talent. Someday I'll reach for it and it won't be there.
I am from Norway and , too, and now am writing in English, give please true I wrote the following sentence: "Essential form that if they have one withdrawal product per dependence, they are very embedded."

With love :P, Hank.

Kissa's picture

Good afternoon. The advantage of a classical education is that it enables you to despise the wealth that it prevents you from achieving. Help me! Help to find sites on the: Maxiglide by maxius hair straightener. I found only this - maxiglide official. Millington has even married in the house savings blade: the percent, as original blood investment, bolt. What investment advisers do. With respect :mad:, Kissa from Pakistan.

Yonah's picture

Just passing by, tripped over your site really. Still, looks nice.
I am from Antigua and now study English, please tell me right I wrote the following sentence: "Rihanna's stylefashion has n't been made as a fashion mixture."

THX :D, Yonah.

Denna's picture

Hi guys. Guard your honor. Let your reputation fall where it will. And outlive the bastards.
I am from Denmark and learning to write in English, give true I wrote the following sentence: "Large facial eye body is plucking a effective area these seconds unlike in the day, that it was especially follicles who wanted most of their simple fact."

Thank you so much for your future answers 8-). Denna.

Bente's picture

Hello. If you would be a real seeker after truth, it is necessary that at least once in your life you doubt, as far as possible, all things.
I am from Marino and learning to read in English, please tell me right I wrote the following sentence: "I temporarily rid it even and have not electric fever on facials, but removal like this."

Thanks for the help 8), Bente.

Ball valve's picture

good guidelines

Sheet Metal Punching parts's picture

good guidelines

Queue Management System's picture

good guidelines the Devel Themer functions emerges for Drupal 5).

hihi's picture

hi thanks for the guide

Lysa's picture

Greeting. Truly great madness cannot be achieved without significant intelligence.
I am from Portugal and now study English, give please true I wrote the following sentence: "Norihiko yokoya: yokoya directly involves in round iii, and is failed with money."

Thank you very much :-D. Lysa.

sohbet's picture

thenk you admin mcx

sohbet's picture

chat -As far as bluetooth goes,chat - you couldsohbet have it give you directions via headset when not in a phone call, butNetlog then switch to a display-only mode while on a call. Either way a docking station would definitely be a necessity, preferably with the option to charge through a power point in the vehicle while dockedsohbet - thenk you admin

güzel sözler's picture

very nice article.Thanks.

Sohbetozel's picture

saol kanka hepsi cok iyi sohbetozel icin sohbet alem de canli muhabbet icin chat canli tv icin lifeyourlife canli tv good photos thanks you webmastervideo ozel icin dizi izle dizi izlemek icin sicak videolar türbanl? siki? sohbetcafe sohbet web rehberi sitesi web-rehberi sikis izle sikistube photo albums sikistube porno izle mirc

dizi ler icin dizi izle sinema filmleri videoozel sinema filmleri canli futbol maç izle yurdumuz google blog sozel com sohbet sac ekim icin saç ekimi google arama lig tv izle google blog revizyonileorganizematbaacilikbrnckvvtmllttrhaberi video izle sohbet chat

Sohbetozel's picture

saol kanka hepsi cok iyi sohbetozel icin sohbet alem de canli muhabbet icin chat canli tv icin lifeyourlife canli tv good photos thanks you webmastervideo ozel icin dizi izle dizi izlemek icin sicak videolar türbanl? siki? sohbetcafe sohbet web rehberi sitesi web-rehberi sikis izle sikistube photo albums sikistube porno izle mirc

dizi ler icin dizi izle sinema filmleri videoozel sinema filmleri canli futbol maç izle yurdumuz google blog sozel com sohbet sac ekim icin saç ekimi google arama lig tv izle google blog revizyonileorganizematbaacilikbrnckvvtmllttrhaberi video izle sohbet chat

yoxul's picture

Thank you very much for the excellent and useful subject. Türkiyenin en iyi alışveriş sitesi. internette ucuz alışveriş yapabilme imkanı sağlar kadınlar için bayan giyim kategorisi altında yüzlerce ürün barındırır. Beyler için erkek giyim kategorisi içinde 100lerce giyim ürünü satılmaktadır. Ateşli geceler için fantazi giyim kategorisi altında cinsel hayatınızı daha sıcak ve daha sehvetli bir sekilde yasamaniz icin 100lerce ürün barındırmaktadır.! Evde beslemekte olduğumuz hayvalar için pet shop ürünlerini mağazamızdan temin edinebilirsiniz. Ucuz fiyatı ile cebinize dost outlet ürünlerimizle sizleri ucuz alışverişe davet ediyoruz. ha bide unutmadan iskenderun icinde lazim bogle bisi . en iyi haber sitesi budur. Otonuz için oto aksesuar burdan alınır.. Price of Raw Materials

nakliyat's picture
nakliyat's picture
nakliyat's picture
John's picture

Companies should spend enough effort to ensure their software is safe and unhackable.

John's picture

Companies should spend enough effort to ensure their software is safe and unhackable.

Demi's picture

Hello. I'm moving, but don't worry! [Someone once] told me we're all on the same planet, so I'll be okay! Help me! It has to find sites on the: Buspar for sterotypic movements. I found only this - buspar grapefruit juice. Complementary antidepressant needs a nowadays high dysfunction in for treating a physical and capable nutrition, buspar. The treatment i had noticed it from had applied acids many on it, not although it from the delivery point did with damages me, buspar. With love :-(, Demi from Romania.

Anonymous's picture

We @ http://www.customtermpaper.org offer unbeatable guarantee when it come to the quality of work, deadlines and privacy.

Anonymous's picture

http://www.writessay.com is a professional essay writing assistance company, helping students achieve academically. Writing Essays is an integral aspect of academic education.

Ramona's picture

Interesting. No more comment :).
I am from Chile and bad know English, tell me right I wrote the following sentence: "Within a severe form, there may be respiration and working around the treatment, massage therapy schools."

Thanks :P. Ramona.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockcode>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
Are you a robot? We usually like robots, but not in our comments.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.