I am creating a very simple cms for my site and rather than using html, I'd like to insert content in the same kind of wiki-format that's used by the Trac project.
Do you know of any open-source php scripts/classes that I can grab and use for this?
Note: I am not trying to create a wiki site. Just that formatting aspect - like how this stack exchange site accepts wiki mark-up and renders it nicely.
After doing some more research, I think I've found it.
The Forever For Now wiki-syntax-to-html parser is pretty much the same as the formatting on the Trac project.
~I have not looked at the code yet, but its pretty likely to be cool. (like Fonzie)~
Edit - I've, now, looked at the code and its beautiful and elegant and does the job.
PHP Markdown might work for you.
Related
I want to implement a commenting system for my website. I looked around and found CKEditor to be the best WYSIWYG editor I found. I tried its bbcode output and it works perfectly. However if I use bbcode output, when I want to show the comments to the users, I should use a reliable parser to parse the bbcode to HTML. If I use HTML output, I may need to use something to prevent XSS in the comments. Which way you suggest for a simple commenting system. I already integrated CKEditor to my system and prefer a very lightweight and simple approach without so much bloat (like PEAR). Also, StackOverflow seems pretty awesome. Is it possible to use something similar for my php?
I should use a reliable parser to parse the bbcode to HTML.
PHP has a pecl BBCode extension.
Also, StackOverflow seems pretty awesome. Is it possible to use something similar for my php?
SO uses Markdown. Markdown parser in PHP is also available
Background
I'm looking to create a wiki-style website.
First I took a look at http://en.wikipedia.org/wiki/List_of_wiki_software
Wanting to use PHP and being sceptic about using plain file storage the choice was lijited down to three alternatives:
Tiki Wiki CMS Groupware
PhpWiki
MediaWiki
Correct me if I'm wrong but all of these felt very heavyweight and pretty much overkill for a rather small project.
The question
My idea was then to use some kind of existing libraries and/or tools for the history, diff and markup parts but implementing the rest myself.
Do you know of any (good) libraries and/or tools like these?
Use an existing library like Markdown for marking up wiki text. Extend it if you have to. A diff algorithm for a wiki can be as trivial as you want it to be. First result on google for php diff showed an extremely simple algorithm that will probably get you started in the right direction.
PHP Diff Algorithm
PHP Markdown
Also don't forget about Github! There are all kinds of wiki projects written in PHP on there. Like this one!
I'm developing my first web application using PHP, MySql, and HTML, but I'm at a roadblock: now I have to start piecing all the pages, modules, and included files into an actual 'application'. I'm really trying to make this an answerable question, and not a discussion topic, but now I'm thinking about 'web design' - and I don't want to have to learn css and all that, because I want to speand my time programming and not designing. So what I'd like is a utility where I can visually design, say a menu bar, and just paste the code into my application where I can work with it. Or I want to format text visually, and paste the css file into my application. I guess what I want to easily design a layout with forms, images and graphics, and have them show up with my dynamic tables. So my question is - is it a good option to go with a big design program like Dreamweaver for this, or is there an easier way? I'm not really even a programmer (can you tell?), and I'm figuring this out as I go. As an aside, I'm pretty pleased with what I've got so far - I think the functions and modules are pretty useful, and the end product (however I get there) will be great. Apologies for the rambling question, and any advice is really appreciated.
In a perfect world, development would happen entirely independently of design and you could focus on only what most interests you.
But that isn't reality.
Learning HTML and CSS will be invaluable if you expect to have any success with this project or your next. And they are not that hard to learn.
My advice? Download Notepad++ (or TextWrangler if you're on a Mac), FireFox, FireBug, and start playing around. Do some tutorials. Force yourself to go through the process.
No reason to avoid learning something.
You should really learn HTML and CSS or alternatively hire a web designer. Code produced by Dreamweaver and similar programs is terrible. Especially if you try to mix it with PHP you'll get problem. Really, at least write the markup yourself, the styling may be done by another person ;)
I think even if you don't want to become a "web designer", it's still worth learning the basics of CSS. Just read through the W3Schools CSS tutorial - that will give you enough to get started, and won't take long.
I wouldn't recommend going the Dreamweaver route - you'll learn a lot more if you code by hand.
I'm looking for a comprehensive and well maintained wiki syntax Parser for PHP, does anybody know of one? I can find some really good parsers for markdown and bbcode but am having trouble with finding a decent wiki parser.
I prefer markdown myself, but I'm writing post functions for a CMS and I'd like to give end-users a choice.
I thought about downloading a copy of MediaWiki and seeing how they do it, thoughts on this as an option?
edit:
I've already looked over the PHP parsers at http://www.mediawiki.org/wiki/Alternative_parsers and none really do everything I want. see comment on #middus answer.
See the links over here, there are quite a lot of alternate parsers for MediaWiki's wiki syntax.
http://toolserver.org/~magnus/wiki2xml/w2x.php looks promising to me.
The one in DokuWiki is relatively re-usable, at least it looks so.
Does anybody know of a good tool that cleans up files with php and html in it? I've used Tidy before but it doesn't do a good job at leaving the php code alone. I know there are various implementations of tidy but does any tool reign champion specifically for pages with html and php?
Cleaning your code starts with separating PHP from HTML !
I am aware that this is a pretty old question but still a valid one. I currently use this and it seems to be doing a decent job: PHP Formatter
For HTML, CSS and JS, DirtyMarkup is a handy tool. Only drawback of these is that you have to copy and paste the code twice.
As far as I know, Tidy is the "reigning champion" when is comes to cleaning html code. The only other tool I've personally used in cleaning code is within Adobe Dreamweaver.
I would agree with seperating your HTML and your PHP code. However, I think you have to think of it kind of backwards. I would seperate your HTML code from your PHP code. Take your HTML and block it up and use include 'html_code_1.php';. Thus you can run Tidy on your HTML and not worry about it affecting your PHP code.
I previously had this problem, however had issues with other programs reorganizing what I coded, and trying to clean it up usually ended up doing more harm than good. To solve this, I am starting to learn the ins and outs of Code Igniter, a basic PHP framework that uses the MVC approach to splitting HTML and PHP. I haven't tested much, but it looks like much less hassle than writing HTML and PHP straight into the single file.
You can use this PHP class, if you can't install the "Tidy" module (sometimes when you buy hosts you can't).
http://www.barattalo.it/html-fixer/