By nfajardo on
Hi community,
I'm developing my first module, is a simple weather block, thaht brings the information from yahoo rss weather channel. I create the followings function in .module:
simpleweather_help
simpleweather_perm
simpleweather_block
simpleweather_admin
simpleweather_all : is empty
simpleweather_menu.
When i installed, and assign the block to a certain region , when the page refresh start to fill with some print_r stuff, a never ending variables, and my block layout damages.
Every is back to normal when i unistall the module.
I need some help please.
Thks.
Comments
It looks like there is a
It looks like there is a print_r() statement inside simpleweather_block() ?
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
i check my code i didnt found it..
Hi, thks for your help, i check the code i didnt found any print_r stuff. I never see that before, i forget some issu, but in the next answer you can see it.
Thks,
i appreciated your help.
You have a print_r()
You have a print_r() function call and this function will throw the output(array index and values) to the browser.
I suppose you need this result and you need to display this output.
$output .= theme('table', $header, $array_content);
here $header is the heading content, if you need to list the content. $array_content is the informations stored in the array. Now your result will be displayed in the theme, will not damage your layout.
Hope this will help
Cheers
That was my first though
Thnks for your concern, i really apreciated it. here is the code: I forget something: not everything backs to normal, some of assigns block, change the region: for example, if a x block is assign to top header(this was created in template.php) region, after install the module and assign my simpleweather block, messup with the print_r never-ending stuff, unistall the module, the x block is in another region...
I hope this is helpful,
and i really apreciate yor help
OK this all very
OK this all very odd!
Firstly, your code above clearly doesn't include print_r(). Nor does Drupal core. Some contrib modules do, e.g. devel, but I think you would know if you were using devel's print_r(). Is it in a custom block?
Secondly, if you look at your HTML page source, you should be able to work out where the print_r() is being called e.g. if it is in a block you should see a div with revealing id information.
Thirdly, I did once have problems with blocks not appearing where I expected. I never got to the bottom of it; partly it was just a matter of having different block positions in two almost identical themes, but there was also something else funny going on. A quick look at the {blocks} table may be revealing. You may even be able to delete stuff from that to have it regenerated (but please backup first!!!!).
Also if you are viewing the site in one browser as an Anonymous user and have caching on then block changes may not show up immediately (I'm not sure if changing block settings forces a cache clear - maybe it does, I don't know).
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
thks
Ok, thanks for your advice, the site has devel module, and the backtracing option is on.
I going to revise the devel and the block cache module, perhaps the problem is there...if i found something i will tell you
thks again!!!
Ah, block cache, that sounds
Ah, block cache, that sounds highly relevant ..!
Good luck,
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Finally i got it!!!
Sorry, but it was my fault after all. The never ending print_r stuff was causing by devel node access. When he found an error i think it backtracking all, the error was caused by the other two files that i include in my module. They have ONE BLANK SPACE AND ONE ENTER. That error cause the famous error:
warning: Cannot modify header information - headers already sent by (output started at /home/www/mysite/sites/all/modules/simpleweather/class.weather.php:2) in /home/www/mysite/includes/common.inc on line 309.
When i unistall devel and devel node access, drupal show me the error.
I learn my lesson, take a look the code, even if is mine.
Thanks a lot.
Glad you found it! It's
Glad you found it!
It's generally suggested not to include the closing ?> if possible, to avoid this problem.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk