You are not logged in.
I made mBlog for an assignment, but it turned out that it's just the kind of thing that Arch linux users would like.
It reads all of the files from a specified directory, and displays them in a html page.
I only just learnt php this afternoon, so it's really simple and small. Any suggestions on how to improve the code are most welcome
http://github.com/neofish/mBlog/raw/master/index.php
Last edited by neofish (2010-08-21 12:26:30)
Offline
wow you weren't kidding with the minimalist. It's really short, but I'm sure you could improve on that a bit further. For example make the computer do the boring work like putting the title of a blog post into the needed html tags. Or stuff like that. Just automate it a bit further, because else you can just have one html file to write everything into (which is it's own nice thing on its own )
But it's a cool minimalist idea!
cheers
Barde
Offline
fwiw, for the uzbl website we made something similar, using the phatso php micro-framework from Judd V.
it's similar, but supports markdown formatting and simple url routing.
http://github.com/Dieterbe/uzbl-website
< Daenyth> and he works prolifically
4 8 15 16 23 42
Offline
I can't understand how it works
Offline
i expanded upon this into my own little mini blog script, this was a great idea
Offline
Any suggestions on how to improve the code are most welcome
Try to get it to validate, at least for most expected input (wrapping the content in <pre> tags might be enough to encapsulate it).
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
I believe the C-style comments at the top will interfere with your output, since they are not wrapped in <?php ... ?>. (Note that I have not written PHP in ages.)
i expanded upon this into my own little mini blog script, this was a great idea
It's good to see I'm not the only person who uses 'cock' as a metasyntactic variable.
Offline
As I said, I'm VERY new to php, so the original script is the best I could do.
Fixed up the comments and added a readme. I'm currently working on validating it <.<
>.>.
Please feel free to give me patches, I'm more than happy to use anyone's suggestions. (and thanks for everything mentioned so far)
Offline
It would be very easy to add Markdown support, which - I think - most people would like. You can download it at the PHP Markdown site and then add the line..
require_once 'markdown.php';
..to the top of your file. (Within the <?php .. ?> tags, of course).
And then you're able to simplify your printFile() function a bit:
function printFile($file) {
echo Markdown(file_get_contents($file));
echo '<hr />';
}
Edit: and here's the PHP doc page for file_get_contents(), in case you haven't come across it before..
Last edited by upsidaisium (2010-08-26 12:46:06)
I've seen young people waste their time reading books about sensitive vampires. It's kinda sad. But you say it's not the end of the world... Well, maybe it is!
Offline
Just updated this with most of the suggestions made, slow development much
I have added markdown, file_get_contents() (fgets was a stupid idea), css, and have wrapped the posts up in <article> tags.
Offline