Jump to content

Facebook Markup Language


canadabeeau

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.