canadabeeau Posted April 28, 2010 Share Posted April 28, 2010 Does anyone care to explain how FBML (in their words) works? How it is called, used and does it replace a HTML DTD or supplement it, if either way how? Any help is appreciated Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/ Share on other sites More sharing options...
canadabeeau Posted April 28, 2010 Author Share Posted April 28, 2010 I am more interested in how their xmlns:fb="http://www.facebook.com/2008/fbml works and looks, how can I do/make my own like FB? Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1049762 Share on other sites More sharing options...
lex87 Posted April 28, 2010 Share Posted April 28, 2010 The link below may help(?) http://www.moneymakerdiscussion.com/forum/wh-download-section/19667-get-facebook-3-step-pages-script-fbml.html The code is posted in the first thread, top of the page. The poster says "You need to do some modifications (insert your links obviously, add paths to pictures, edit the labels of the friend invite message) but the script works like a charm." CHeers. Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1050036 Share on other sites More sharing options...
canadabeeau Posted April 29, 2010 Author Share Posted April 29, 2010 thanks for the link, I know how to integrate it but am more interested in how to make my own version Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1050245 Share on other sites More sharing options...
canadabeeau Posted April 30, 2010 Author Share Posted April 30, 2010 many views, no replies on how I can make my own markup language like FBML, links, tutorials (even basic ones) much appreciated If any one feels my post fits better in a different forum (outside of php freaks) or in another category please let me know as well Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1051074 Share on other sites More sharing options...
Adam Posted April 30, 2010 Share Posted April 30, 2010 many views, no replies on how I can make my own markup language like FBML Maybe there isn't a tutorial? I'm pretty sure facebook's top developers will have put many, many man hours into developing FBML. You won't find a tutorial just a few pages long covering how it can be done. If you're literally unable to think of any possible way as to how they might do it, then perhaps it's a bit premature to be trying? Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1051119 Share on other sites More sharing options...
The Little Guy Posted April 30, 2010 Share Posted April 30, 2010 basically they use php to parse the code.... Hello <fb:name uid="12345" /> Example output: Hello John First they built a class that will get the users information, such as the name: Profile.php <?php class Profile{ public function first_name($id){ $sql = mysql_query("SELECT * FROM users WHERE id = $id"); $row = mysql_fetch_assoc($sql); return $row['first_name']; } } ?> next they parse your content from the string $content, and pass the information to the above class: <?php // include some required files include 'database.php'; include 'Profile.php'; // Load your html $file = '/templates/file.html'; $handle = fopen($file, 'ab'); $content = fread($handle, filesisze($file)); fclose($handle); // Create an instance of the Profile class $profile = new Profile(); // Parse your html $content = preg_replace("~\<fb\:name uid=\"(.+?)\" \/\>~sei", $profile->first_name('$1'), $content); echo $content ?> So... here is the lowdown on what is happening... - First some required files are included. - Next your file is loaded up - A class instance is created for profile - They pares your html with preg and replace the FBML with HTML - Finally they echo out the file result. Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1051163 Share on other sites More sharing options...
Daniel0 Posted April 30, 2010 Share Posted April 30, 2010 Uh... use an XML parser to parse XML. Look up what "XML namespaces" is. Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1051175 Share on other sites More sharing options...
canadabeeau Posted May 2, 2010 Author Share Posted May 2, 2010 so FB has this <html xmlns="http://www.w3.org/1999/xhtml" xmlns:"http://www.facebook.com/2008/fbml"> so if I want <html xmlns="http://www.w3.org/1999/xhtml" xmlns:"http://www.mysite.com/ml"> what goes there? Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1051833 Share on other sites More sharing options...
xcoderx Posted May 2, 2010 Share Posted May 2, 2010 i too once saw someone site it was a wap site it had some .do markup dunno how they did but every files were like index.do message.do what is the do extn? Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1051836 Share on other sites More sharing options...
canadabeeau Posted May 2, 2010 Author Share Posted May 2, 2010 I know that what I make is a supplement to XHTML, and know that I have to do the DOM reparse same as FB help much apreciated Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1051837 Share on other sites More sharing options...
canadabeeau Posted May 2, 2010 Author Share Posted May 2, 2010 I understand that the xmlns is just a 'pointer' The namespace URI is not used by the parser to look up information. The purpose is to give the namespace a unique name. However, often companies use the namespace as a pointer to a web page containing namespace information. So the JS that you also must call must do the replace buy why do they need to do the DOM parse? Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1051847 Share on other sites More sharing options...
canadabeeau Posted May 3, 2010 Author Share Posted May 3, 2010 so if it uses PHP preg_replace why does it need DOM reparse? Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1052241 Share on other sites More sharing options...
Daniel0 Posted May 3, 2010 Share Posted May 3, 2010 so if it uses PHP preg_replace why does it need DOM reparse? Who said that Facebook used preg_replace() to do it? TLG used preg_replace() in his example, and I said "use a real XML parser". Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1052385 Share on other sites More sharing options...
ignace Posted May 3, 2010 Share Posted May 3, 2010 Hi Rhodry, Do a read-up on XSLT, DTD, XML, XPath, XQuery, .. as that's what you are looking for. Afterwards you can take it a step further and like Daniel suggested write your own. xmlns:rhodry="path/to/rhodry/dtd" (<rhodry:talk/>) http://www.w3schools.com - is a good place to start Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1052443 Share on other sites More sharing options...
Daniel0 Posted May 3, 2010 Share Posted May 3, 2010 Actually, I didn't want him to create his own XML parser, but just to use an existing one like SimpleXML or DOM in PHP. Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1052446 Share on other sites More sharing options...
ignace Posted May 3, 2010 Share Posted May 3, 2010 Actually, I didn't want him to create his own XML parser, but just to use an existing one like SimpleXML or DOM in PHP. Oh, I thought you meant to write his own xmlns:rhodry so he could use something like <rhodry:talk message="hello world"/> all perfectly possible using X-series stuff (I think, I can vaguely remember we did something similar in an XSLT class) Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1052486 Share on other sites More sharing options...
Daniel0 Posted May 3, 2010 Share Posted May 3, 2010 Right, yeah. Define his own namespace like that. XSLT might be able to do what he wants actually. I haven't really used it very much. Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1052489 Share on other sites More sharing options...
ignace Posted May 3, 2010 Share Posted May 3, 2010 Right, yeah. Define his own namespace like that. XSLT might be able to do what he wants actually. I haven't really used it very much. Blizzard and Facebook uses it, I've toyed with it in the past but it never appealed to me. It's quite useful when you don't have access to a scripting language or if you don't mind that all data (XML) is publicly available (unless you parse XSLT server-side, but that defeats the purpose IMO). I think I've found a CMS application once that was hosted on a central PHP server and allowed you to add FTP-servers, add data, add HTML/CSS templates, and drag-and-drop (+adjust look eg number of items) data on these templates. Once you were done, you could publish (XML+XSLT+CSS+images) it to your FTP-server. I tried to find it through Google but nothing turned up. Using my delicious bookmarks I found pagelime (http://pagelime.com/) but it's not what I was looking for. I remember it was still in beta when I first came across it. Quote Link to comment https://forums.phpfreaks.com/topic/200014-facebook-markup-language/#findComment-1052509 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.