Hi,
I created my own xml file from my tables (needed to export my data to an external application), I would like to have this form outside of the traditional body content of Joomla.
Do you have any idea how to do🤨
In advance, thank you
Fabian
I created my own xml file from my tables (needed to export my data to an external application), I would like to have this form outside of the traditional body content of Joomla.
Do you have any idea how to do🤨
In advance, thank you
Fabian
Hi Fabian,
You can display a Joomla! page without the template by using &tmpl=component in the URL. Does this do what you need?
Bob
You can display a Joomla! page without the template by using &tmpl=component in the URL. Does this do what you need?
Bob
I already use that (I read this on your forum :wink: )
but I would like to have a page without the html,head and body tag...
But by chatting with you I realize that will be not possible.
Actually I take my xml generated code and cut&past in a new file.
For have this I should create a file from my php form.
There is a post about that somewhere?
regards,
Fabian
but I would like to have a page without the html,head and body tag...
But by chatting with you I realize that will be not possible.
Actually I take my xml generated code and cut&past in a new file.
For have this I should create a file from my php form.
There is a post about that somewhere?
regards,
Fabian
Hi Fabian,
Please can you say a bit more about what you are doing here?
It's not too difficult to create an XML file from form data using the PHP XML libraries if that is what you need.
Or you can FTP a file over to an external site - but I don't think that is what you need.
Bob
Please can you say a bit more about what you are doing here?
It's not too difficult to create an XML file from form data using the PHP XML libraries if that is what you need.
Or you can FTP a file over to an external site - but I don't think that is what you need.
Bob
I didn't use the xml library I parsed it by hand.
I created this in a chronoform
the following code create an xml file for selected categories.
I only selected field that I needed.
the first loop work for jos_content = normal content (could be more generic)
other loops were created to retrieve fields created with flexicontent. (quite generic)
This code support additional flexicontent plugin fields.
This code is not perfect so if you have suggestion to improve it, I will appreciate.
++,
Fabian
I created this in a chronoform
the following code create an xml file for selected categories.
I only selected field that I needed.
the first loop work for jos_content = normal content (could be more generic)
other loops were created to retrieve fields created with flexicontent. (quite generic)
This code support additional flexicontent plugin fields.
This code is not perfect so if you have suggestion to improve it, I will appreciate.
<?php
$db =& JFactory::getDBO();
/* ENTETE */
$myFile = "alliance-directory.xml";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><alliance-directory>";
fwrite($fh, $stringData);
/* FIN ENTETE */
/* FIRST LOOP */
$stringData = "";
$query = "SELECT `id`,`catid`,`title`,`introtext`,`fulltext` FROM `jos_content` WHERE `catid` = '18' OR `catid` = '17' OR `catid` = '12' ORDER BY `catid`";
$db->setQuery($query);
$records = $db->loadAssocList();
foreach ( $records as $item ) {
$stringData .= "<item id=\"".$item[id]."\" catid=\"".$item[catid]."\">";
$stringData .= "<title><![CDATA[".$item[title]."]]></title>";
$stringData .= "<description><![CDATA[".$item[introtext].$item[fulltext]."]]></description>";
/* SECOND LOOP */
$query3 = "SELECT `field_id`,`item_id`,`value`,`valueorder`
FROM `jos_flexicontent_fields_item_relations`
WHERE `item_id` =".$item[id]." ORDER BY `field_id`";
$db->setQuery($query3);
$lignes = $db->loadAssocList();
$lastid="";
$nbr_b=0;
foreach ( $lignes as $o ) {
$query2 = "SELECT `id`,`field_type`,`label`,`name`
FROM `jos_flexicontent_fields` WHERE `id` =".$o[field_id]." ORDER BY `field_type`";
$db->setQuery($query2);
$lignes2 = $db->loadAssocList();
if ($o[value]!=""){
$nbr_l=0;
foreach ( $lignes2 as $o2 ) {
$nbr_l++;
if($lastid!=$o2[id] and $nbr_l==1){
if($endtag and $nbr_b>0){
$stringData .=$endtag;
}
$stringData .= "<".$o2[name]." id='".$o2[id]."' field_type='".$o2[field_type]."' >";
}
$first=0;
if($o2[field_type]=="image" or $o2[field_type]=="weblink"){
$image = unserialize($o[value]);
//print_r($image);
foreach($image as $key=>$value) {
$stringData .= "<".$key."><![CDATA[".$value."]]></".$key.">";
}
}else{
$stringData .= "<value order='".$o[valueorder]."' >";
$stringData .= "<![CDATA[".$o[value]."]]>";
$stringData .= "</value>";
}
if($lastid!=$o2[id]){
$endtag="</".$o2[name].">";
}
$lastid=$o2[id];
}
}
$nbr_b++;
}
$stringData .= $endtag;
$endtag=null;
/* END SECOND LOOP */
$stringData .="</item>";
}
fwrite($fh, $stringData);
/* END FIRST LOOP */
/* FOOTER */
$stringData = "</alliance-directory>";
fwrite($fh, $stringData);
fclose($fh);
/* END FOOTER */
?>
++,
Fabian
Hi Fabius,
Your code looks OK -- I wouldn't have done it quite that way but there's nothing wrong with it.
But I still don't understand what question you are asking?
Bob
Your code looks OK -- I wouldn't have done it quite that way but there's nothing wrong with it.
But I still don't understand what question you are asking?
Bob
I have no more question Bob, Thanks
I solved my problem with the code that I posted. (It was not what I imagined at the beginning but I am not sure that my mind was up and running at this moment 😲 )
Have a good week,
Fabian
I solved my problem with the code that I posted. (It was not what I imagined at the beginning but I am not sure that my mind was up and running at this moment 😲 )
Have a good week,
Fabian
This topic is locked and no more replies can be posted.