Why "Max made me put this here"? - php

Every MediaWiki has a load.php.
If called without parameters it returns:
/* No modules requested. Max made me put this here */
As a curious programmer I wonder:
Why did he do this?
I am sure in a big project like this there is a good reason for it. Looks to me like it would be bad to return an empty file to an ajax query or something like it.
BTW: Normally it is called with parameters like this: load.php?debug=true&lang=de&modules=user.options&only=scripts&skin=modern&user=pi&*

This message comes from ResourceLoader.php. In the history of the file, using git blame, you can see the code was written by Roan Kattouw (RK) in this changeset. From the changeset comment:
Make load.php output a comment explaining what's going on when no modules were requested rather than outputting nothing. Max made me do this because he hates blank pages
So, your answer is, because Max hates blank pages, and if you want to know more, you should ask Roan. My guess would be that it's a debugging aid; rather than staring at a blank page wondering why it's blank, at least you know that you did something that caused a module loader request to load nothing...
As #svick points out, there is also a link to the code review, including discussion of whether it's a good idea to mention Max at all. Mentioning Max was seen as a possibility to partially close MediaWiki bug 20281, which notes that there aren't enough Easter Eggs in MediaWiki.
And that's why public repositories of open source software are cool :D

It is just to know, whats going on.
If i browse the load.php file of my MediaWiki installation with my web browser and want to check if there are any errors, they may get displayed or leave me a blank page.
A blank white page indicates a PHP error which isn't being printed to the screen.
But if i see a comment thats similar to /* No modules requested. Max made me put this here */. i do know its alright
AND that is the reason, why they needed to diff it.

Related

PHP selectively includes part of a file

OK, so on some of the pages on my site, I've included a foot.php file at the end so that when I make changes to it, it effects all pages on the site. On most pages, this works perfectly, but on some pages, it just cuts off, and no includes after it take effect. The weird thing is that it includes only a portion of the file on pages where this happens.
I thought it might be because of the number of includes I used, but I have pages with more that work just fine. Take for instance, this one:
http://www.kelvinshadewing.net/codeSquirrel5.php
Here, you can see the bottom gets cut off, and if you view the source code, the rest of what goes in that div is gone, yet the div itself is closed off properly. But then go here:
http://www.kelvinshadewing.net/sprTartii.php
You'll see that the full code is there, and the Disqus app is present as well. This issue has been going on since before I added Disqus, and also happened when I'd been using includes in a different way to generate global content, so it's something about those pages in particular. It does it with only my Squirrel tutorials, and nothing else. I'm totally stumped and have no idea what's causing this. I've gone over my code a dozen times, and verified that every page uses the same PHP scripts.
As for the scripts themselves, it's just this:
<?php include "foot.php";
include "disqus.php"; ?>
The problem just disappeared, so I'm ruling it as a server glitch. If anyone else is reading this, I suggest checking out Andrew's comment, because that code was nice to know.

Adding PHP includes to my Warp JoomlaTemplate

I recently purchased this script from Code Canyon and I want to work it in to my Warp Joomla template.
http://www.geertdedeckere.be/shop/thumbsup/help#template-list
I hope someone on here has some experience with the Warp framework. I have followed the creator's instructions to the T but I keep getting a white screen. Each Warp template is based on a config.php and template.config.php file. I have tried adding code as outlined on YooTheme support ticket: http://www.yootheme.com/support/question/28978 with no avail.
I also tried doing some other experiments, but while I wait on YooTheme's ridiculously long support response, has anyone the slightest idea of how I can call the initial PHP function and the CSS/Javascript files in my Warp template? I managed ot get as far as the CSS (I am unsure whether or not the init.php call is being seen, even with a relative path. The creator's original commands:
<?php echo ThumbsUp::css() ?>
<?php echo ThumbsUp::javascript() ?>
Are giving me a white screen, which I assume (and I don't know PHP inside and out / but I am tech literate) is because either the original call is not being placed before all other content output, due to a joomla structural issue I am not aware of (i.e. I am putting the code in the wrong place), or I am incorrectly placing the echo commands. Please help!
You haven't mentioned a Joomla! version so I'm presumming 2.5.x in my comments.
Putting this type of functionality in a Joomla! template is not a good idea, you would be better off looking at one of the existing extensions for Joomla! that provide "Ratings and Review" functionality including simply like/dislike options. The majority are free.
Having said that to determine the root cause of a PHP problem you will need to do the following:
Turn on "Debug System" (Site->Global Configuration->System->Debug Settigns)
Turn the sites "Error Reporting" level up,(Site->Global Configuration->Server->Server Settings). If it's currently None the start with Simple and work your way up (unless you're completely confident that you can log in modify the configuration.php file manually if the site stops working after ramping the error reporting all the way up.
N.B. Do not leave these settings on for any longer than necessary.
From the output generated you should be able to pin point the error, or the area the problem is occurring in. At that point you could extend your original question and provide us with more details like the error message, the code that causing it etc...

Internet Explorer not rendering pages correctly because of a PHP class

I have a very strange problem and i don't know what to do about it. My site seems to work just fine all browsers other than internet explorer, so i've been trying to figure out why.
I've narrowed it down to the a file that I'm including in my site, this file is a php class that has a number of different functions like login getters and setters and so on.
I took all the php code out of my pages and it renders fine, so i added the php back in line by line and released that it stopped working when i used this:
require_once 'classes/Membership2.php';
Does anyone know why some php code will be messing with the style of my website.
For more detail on the matter, i have a number of divs that are centered, they all have curved edges as well as shadows. So by taking away the php i can see that IE is loading the page properly, no incompatibilities or anything like that.
Has anyone had a problem like this before? While i'm waiting for an aswesome or two i'll be removing functions and part of the code till i can narrow it down. (I would give code, but the file has a lot of lines of code.)
Thanks for the help.
Oh yeah and I'm testing on Internet Explorer 9 and every other browser is the latest version or close enough.
Okay so i've done some more digging into this, i've found that if i delete all the code in the class (All the functions) and leave just and empty class in the include file it still doesn't work. Okay, so in my view that means the functions aren't whats making this problem. So i deleted EVERYTHING, so now the include points to a blank php file. This worked and the page rendered as it should but obviously there is no functionality, i can't login or anything like that. I decided to add a constructor instead of leaving it as default, this function does nothing but return true; and it made the site mess up again.
Does this info change anything? Also i'm reiterating the fact that i do not get this error or any other browser but Internet Explorer 9 (Haven't tried any other IE version).
Thanks again for the help.
Okay, so i've solved the problem. At the start of my PHP class i have used
<!-- blah blah blah -->
forgetting that there is only PHP in this document and no HTML. So when i include the file it just outputs that into my source code and and messes things up, should have used the PHP commenting style.
Still strange that EVERY browser other than IE just ignores this and goes about its business, even the site that #blankabout suggested didn't give me any error (Although i assure thats because its part of the included PHP file and not the HTML itself).
as #fajran says to you, save both outputs with "view source code" on the browser and compare them to find the diference. To compare outputs use winmerge or similar tool. Once you now which text it generating the trouble, modify it inside the include file.
Given that your php, because it runs on the server, should never actually reach the browser, it may very well be some unterminated HTML or similar that is causing the problem. Perhaps the PHP is causing a break in the HTML that is unexpected.

Site is calling same file multiple times but doesn't show in code?

I am honestly not sure where the issue lays but here is my problem:
I have a single file: card.gif. When I check firebug or Google pagespeed, I learn the file is called twice during the page fetch once as normal file name and a second time with a random number (that does not change). Example:
card.gif
card.gif?1316720450953
I have scoured my actual source code, the image is only called once. It is not called in a CSS file. To be honest I have no idea what is the issue, some thought that when I originally installed mod_pagespeed that it appended ID's to each image in cache for any future overwrites but I can't be certain.
Has anybody ever had this issue before?
In the end - Dagon's comments above led me to believe that things like Firebug and Pagespeed may not always be correct. I do show two images being loaded in the timelines for both plugins but it is very difficult for me to decifer otherwise. If another answer is provided contradicting this, I am more than happy to test that theory.

sifr not working in browsers, but can see it in dreamweaver preview

this is my first time trying to use sifr, so pleave be gentle and forget my noobness :).
ive been having some problems getting sifr to work... when finally it looked like it did (the dreamweaver preview saw the font change), no browser can see it...
http://www.creatica.ro/in2itivetest/index.html
this is the site im working on.
thank you in advance for helping.
One of your javascript includes is returned as a 404, meaning you're referring to a non-existing file (js-file) from your HTML document.
http://www.creatica.ro/Scripts/swfobject_modified.js is the path of the missing file. Would make sense for that to screw up something to do with flash I reckon :)
Check where the file actually is and move it or change the URL to reflect the correct path.
PS: Nice site by the way. Even though I found the top menu slightly annoying.. (the hover effect feels over the top and sluggish)

Categories