The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
fetch XML data to template?
hello,
i have a question and need your help, how can I fetch data from XML file to template? If I know, when I reply to a thread that is callback via XML? Thank you |
#2
|
|||
|
|||
I'm not sure what you're asking. Do you have php code reading an xml file, and you want to insert that into a template?
|
#3
|
||||
|
||||
Yes exaclty!
I know how to create vbb XML group (file ajax.php: starting at line 123) but I want to insert them to a template :-) Do you have any experience (or have a tutorial somewhere)? Thank u |
#4
|
|||
|
|||
I don't have any experience with it, but if you're using one of the vb classes to build xml output (like is done in ajax.php to return xml), you can call fetch_xml() to get a string instead of calling print_xml(). Then you can use that in a template like you would any other string.
|
#5
|
||||
|
||||
I dont have it yet,
here is example php misc_start hook: PHP Code:
You have: Code:
<users><user userid="1">admin</user><user userid="5">newregister</user><user userid="4">nicktest</user><user userid="6">testreg</user><user userid="3">testregister</user><user userid="2">user</user></users> Thanks !!! |
#6
|
|||
|
|||
Sorry, I'm still not exactly sure what you want to do. ajax.php actually returns some html (which in a way can be thought of as xml), and the javascript uses it to set the innerHTML property of an element. I suppose there isn't any reason that you couldn't return <user> or other custom tags, but then you'd need to process it using javascript. It's probably easier to format it as html (using templates if you want) if that's how you're planning to display it.
Maybe I'm still missing the point of what you're doing. If you want to make a plugin that returns user data as xml, that's fine, but it doesn't have anything to do with vbulletin templates. How do you want http://localhost/upload/misc.php?do=xml to be used? What is going to request that data? |
#7
|
||||
|
||||
http://localhost/upload/misc.php?do=xml is just an example of XML output.
I want to make some AJAX like here: http://www.w3schools.com/ajax/ajax_xmlfile.asp But return all tags into vbb template. Hmm, my English is not good enough Please have a look here: http://www.w3schools.com/ajax/tryit....e=tryajax_xml2 You click Get CD info then you will have CDs info, but I want CDs info into templates oof, |
#8
|
||||
|
||||
I have this ajax code, it returns the usernames only, example: mokujin, kh99
Now what I need to do to return with userids: mokujin, kh99 PHP Code:
HTML Code:
<a href="member.php?u={vb:raw mokusers.userid}">{vb:raw mokusers.username}</a> Please! Thank youuuuuu!!!! |
#9
|
||||
|
||||
No one? :-(
|
#10
|
|||
|
|||
Well, the template variables are replaced on the server before an html page is sent to the user's browser, so if what you want to do is to create a page that lists some users, you don't need to use ajax. You can build a string variable in php code, then register that to your template.
If you do have some reason to get the list using an ajax call from an html page (to avoid reloading the html page, for example), then what you need to do is process the returned xml using javascript, like is done in the example you linked to. I'm still not sure which one of these you are trying to do. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|