473,735 Members | 4,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

call to undefined function:loadXM L()

1 New Member
Expand|Select|Wrap|Line Numbers
  1. function art_menu_xml_parcer($content, $showSubMenus)
  2. {
  3. $doc = new DOMDocument();
  4. $doc->loadXML($content);//this is the line in question
  5. $parent = $doc->documentElement;
  6. $elements = $parent->childNodes;
need help. my site worked fine on my localhost but when i uploaded it to my live server i keep getting this error
need help to recode line to match my hosting server.
im using php 5
i have attached the common_method file
please help.
my common_method file is attached.please help

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. /* Common Drupal methods definitons using in Artisteer theme export */
  4.  
  5. /**
  6.  * Generate the HTML representing a given menu with Artisteer style.
  7.  *
  8.  * @param $mid
  9.  *   The block navigation content.
  10.  *
  11.  * @ingroup themeable
  12.  */
  13. function art_navigation_links_worker($content = NULL, $showSubMenus) {
  14.   if (!$content) {
  15.     return '';
  16.   }
  17.  
  18.   $output = art_menu_xml_parcer($content, $showSubMenus);
  19.  
  20.   $menu_str = ' class="menu"';
  21.   if(strpos($content, $menu_str) !== false) {
  22.     $empty_str = '';
  23.     $pattern = '/class="menu"/i';
  24.     $replacement = 'class="art-menu"';
  25.     $output = preg_replace($pattern, $replacement, $output, 1);
  26.     $output = str_replace($menu_str, $empty_str, $output);
  27.   }
  28.  
  29.   // used to support Menutrails module
  30.   $output = str_replace("active-trail", "active-trail active", $output);
  31.   return $output;
  32. }
  33.  
  34. function art_menu_xml_parcer($content, $showSubMenus)
  35. {
  36.   $doc = new DOMDocument($content);
  37.   $doc->loadXML();
  38.   $parent = $doc->documentElement;
  39.   $elements = $parent->childNodes;
  40.  
  41.   $nodesToDelete = array();  
  42.   foreach ($elements as $element) {
  43.     if (is_a($element, "DOMElement") && $element->tagName == "li") {
  44.       $children = $element->childNodes;
  45.       foreach ($children as $child) {
  46.         if (is_a($child, "DOMElement") &&($child->tagName == "a")) {
  47.             $caption = $child->nodeValue;
  48.             $child->nodeValue = "";
  49.  
  50.             $spanL = $doc->createElement("span");
  51.             $spanL->setAttribute("class", "l");
  52.             $spanL->nodeValue = " ";
  53.             $child->appendChild($spanL);
  54.  
  55.             $spanR = $doc->createElement("span");
  56.             $spanR->setAttribute("class", "r");
  57.             $spanR->nodeValue = " ";
  58.             $child->appendChild($spanR);
  59.  
  60.             $spanT = $doc->createElement("span");
  61.             $spanT->setAttribute("class", "t");
  62.             $child->appendChild($spanT);
  63.  
  64.             $spanT->nodeValue = $caption;
  65.         }
  66.         else if (!$showSubMenus) {
  67.            $nodesToDelete[] = $child;
  68.         }
  69.       }
  70.     }
  71.   }
  72.  
  73.   foreach($nodesToDelete as $node) {
  74.     if ($node != null) {
  75.       $node->parentNode->removeChild($node);
  76.     }
  77.   }
  78.  
  79.   return $doc->saveXML();
  80. }
  81.  
  82. /**
  83.  * Allow themable wrapping of all comments.
  84.  */
  85. function art_comment_woker($content, $type = null) {
  86.   static $node_type;
  87.   if (isset($type)) $node_type = $type;
  88.   return '<div id="comments">'. $content . '</div>';
  89. }
  90.  
  91. /*
  92.  * Split out taxonomy terms by vocabulary.
  93.  *
  94.  * @param $node
  95.  *   An object providing all relevant information for displaying a node:
  96.  *   - $node->nid: The ID of the node.
  97.  *   - $node->type: The content type (story, blog, forum...).
  98.  *   - $node->title: The title of the node.
  99.  *   - $node->created: The creation date, as a UNIX timestamp.
  100.  *   - $node->teaser: A shortened version of the node body.
  101.  *   - $node->body: The entire node contents.
  102.  *   - $node->changed: The last modification date, as a UNIX timestamp.
  103.  *   - $node->uid: The ID of the author.
  104.  *   - $node->username: The username of the author.
  105.  *
  106.  * @ingroup themeable
  107.  */
  108. function art_terms_worker($node) {
  109.   $output = '';
  110.   if (isset($node->links)) {
  111.     $output = '&nbsp;&nbsp;|&nbsp;';
  112.   }
  113.   $terms = $node->taxonomy;
  114.  
  115.   if ($terms) {
  116.     $links = array();
  117.     ob_start();?><img class="art-metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostTagIcon.png" width="18" height="18" alt=""/> <?php
  118.     $output .= ob_get_clean();
  119.     $output .= t('Tags: ');
  120.     foreach ($terms as $term) {
  121.       $links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description)));
  122.     }  
  123.     $output .= implode(', ', $links);
  124.     $output .= ', ';
  125.   }
  126.  
  127.   $output = substr($output, 0, strlen($output)-2); // removes last comma with space
  128.   return $output;
  129. }
  130.  
  131. /**
  132.  * Return a themed set of links.
  133.  *
  134.  * @param $links
  135.  *   A keyed array of links to be themed.
  136.  * @param $attributes
  137.  *   A keyed array of attributes
  138.  * @return
  139.  *   A string containing an unordered list of links.
  140.  */
  141. function art_links_woker($links, $attributes = array('class' => 'links')) {
  142.   $output = '';
  143.  
  144.   if (count($links) > 0) {
  145.     $output = '';
  146.  
  147.     $num_links = count($links);
  148.     $index = 0;
  149.  
  150.     foreach ($links as $key => $link) {
  151.       $class = $key;
  152.  
  153.       if (strpos ($class, "read_more") !== FALSE) {
  154.         break;
  155.       }
  156.  
  157.       // Automatically add a class to each link and also to each LI
  158.       if (isset($link['attributes']) && isset($link['attributes']['class'])) {
  159.         $link['attributes']['class'] .= ' ' . $key;
  160.       }
  161.       else {
  162.         $link['attributes']['class'] = $key;
  163.       }
  164.  
  165.       if ($index > 0) {
  166.         $output .= '&nbsp;&nbsp;|&nbsp;';
  167.       }
  168.  
  169.       // Add first and last classes to the list of links to help out themers.
  170.       $extra_class = '';
  171.       if ($index == 1) {
  172.         $extra_class .= 'first ';
  173.       }
  174.       if ($index == $num_links) {
  175.         $extra_class .= 'last ';
  176.       }
  177.  
  178.       if ($class) {
  179.         if (strpos ($class, "comment") !== FALSE) {
  180.           ob_start();?><img class="art-metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostCommentsIcon.png" width="18" height="18" alt=""/> <?php
  181.           $output .= ob_get_clean();
  182.         }
  183.         else {
  184.           ob_start();?><img class="art-metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostCategoryIcon.png" width="18" height="18" alt=""/> <?php
  185.           $output .= ob_get_clean();
  186.         }
  187.       }
  188.  
  189.       $index++;
  190.       $output .= get_html_link_output($link);
  191.     }
  192.   }
  193.  
  194.   return $output;
  195. }
  196.  
  197. function get_html_link_output($link) {
  198.   $output = '';
  199.   // Is the title HTML?
  200.   $html = isset($link['html']) && $link['html'];
  201.  
  202.   // Initialize fragment and query variables.
  203.   $link['query'] = isset($link['query']) ? $link['query'] : NULL;
  204.   $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
  205.  
  206.   if (isset($link['href'])) {
  207.     if (get_drupal_version() == 5) {
  208.       $output = l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
  209.     }
  210.     else {
  211.       $output = l($link['title'], $link['href'], array('language' => $link['language'], 'attributes'=>$link['attributes'], 'query'=>$link['query'], 'fragment'=>$link['fragment'], 'absolute'=>FALSE, 'html'=>$html));
  212.     }
  213.   }
  214.   else if ($link['title']) {
  215.     if (!$html) {
  216.       $link['title'] = check_plain($link['title']);
  217.     }
  218.     $output = $link['title'];
  219.   }
  220.  
  221.   return $output;
  222. }
  223.  
  224. /**
  225.  * Format the forum body.
  226.  *
  227.  * @ingroup themeable
  228.  */
  229. function art_content_replace($content) {
  230.   $first_time_str = '<div id="first-time"';
  231.   $article_str = 'class="art-article"';
  232.   $pos = strpos($content, $first_time_str);
  233.   if($pos !== false)
  234.   {
  235.     $output = str_replace($first_time_str, $first_time_str . $article_str, $content);
  236.     $output = <<< EOT
  237. <div class="art-Post">
  238.         <div class="art-Post-tl"></div>
  239.         <div class="art-Post-tr"></div>
  240.         <div class="art-Post-bl"></div>
  241.         <div class="art-Post-br"></div>
  242.         <div class="art-Post-tc"></div>
  243.         <div class="art-Post-bc"></div>
  244.         <div class="art-Post-cl"></div>
  245.         <div class="art-Post-cr"></div>
  246.         <div class="art-Post-cc"></div>
  247.         <div class="art-Post-body">
  248.     <div class="art-Post-inner">
  249.  
  250. <div class="art-PostContent">
  251.  
  252.       $output
  253.  
  254.     </div>
  255.     <div class="cleared"></div>
  256.  
  257.  
  258.     </div>
  259.  
  260.         </div>
  261.     </div>
  262.  
  263. EOT;
  264.   }
  265.   else 
  266.   {
  267.     $output = $content;
  268.   }
  269.   return $output;
  270. }
  271.  
  272. function art_placeholders_output($var1, $var2, $var3) {
  273.   $output = '';
  274.   if (!empty($var1) && !empty($var2) && !empty($var3)) {
  275.     $output .= <<< EOT
  276.       <table class="position" width="100%" cellpadding="0" cellspacing="0" border="0">
  277.         <tr valign="top">
  278.           <td width="33%">$var1</td>
  279.           <td width="33%">$var2</td>
  280.           <td>$var3</td>
  281.         </tr>
  282.       </table>
  283. EOT;
  284.   }
  285.   else if (!empty($var1) && !empty($var2)) {
  286.     $output .= <<< EOT
  287.       <table class="position" width="100%" cellpadding="0" cellspacing="0" border="0">
  288.         <tr valign="top">
  289.           <td width="33%">$var1</td>
  290.           <td>$var2</td>
  291.         </tr>
  292.       </table>
  293. EOT;
  294.   }
  295.   else if (!empty($var2) && !empty($var3)) {
  296.     $output .= <<< EOT
  297.       <table class="position" width="100%" cellpadding="0" cellspacing="0" border="0">
  298.         <tr valign="top">
  299.           <td width="67%">$var2</td>
  300.           <td>$var3</td>
  301.         </tr>
  302.       </table>
  303. EOT;
  304.   }
  305.   else if (!empty($var1) && !empty($var3)) {
  306.     $output .= <<< EOT
  307.       <table class="position" width="100%" cellpadding="0" cellspacing="0" border="0">
  308.         <tr valign="top">
  309.           <td width="50%">$var1</td>
  310.           <td>$var3</td>
  311.         </tr>
  312.       </table>
  313. EOT;
  314.   }
  315.   else {
  316.     if (!empty($var1)) {
  317.       $output .= <<< EOT
  318.         <div id="var1">$var1</div>
  319. EOT;
  320.     }
  321.     if (!empty($var2)) {
  322.       $output .= <<< EOT
  323.         <div id="var1">$var2</div>
  324. EOT;
  325.     }
  326.     if (!empty($var3)) {
  327.       $output .= <<< EOT
  328.         <div id="var1">$var3</div>
  329. EOT;
  330.     }
  331.   }
  332.  
  333.   return $output;
  334. }
  335.  
  336. function artxGetContentCellStyle($left, $right, $content) {
  337.   if (!empty($left) && !empty($right))
  338.     return 'art-content';
  339.   if (!empty($right))
  340.     return 'art-content-sidebar1';
  341.   if (!empty($left) > 0)
  342.     return 'art-content-sidebar2';
  343.   return 'content-wide';
  344. }
  345.  
  346. function art_submitted_worker($submitted, $date, $name) {
  347.   $output = '';
  348.   ob_start();?><img class="art-metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostDateIcon.png" width="17" height="18" alt=""/> <?php
  349.   $output .= ob_get_clean();
  350.   $output .= $date;
  351.   $output .= '&nbsp;|&nbsp;';
  352.   ob_start();?><img class="art-metadata-icon" src="<?php echo get_full_path_to_theme(); ?>/images/PostAuthorIcon.png" width="14" height="14" alt=""/> <?php
  353.   $output .= ob_get_clean();
  354.   $output .= $name;
  355.   return $output;
  356. }
  357.  
  358. function artReadMoreLink($link) {
  359.   $link['attributes']['class'].=' art-button';
  360.   return '<div class="read_more"><p>'.get_html_link_output($link).'</p></div><div class="cleared"></div>';
  361. }
  362.  
  363. function isArtLinksSet($links) {
  364.   if (empty($links)) {
  365.     return FALSE;
  366.   }  
  367.  
  368.   $doc = new DOMDocument();
  369.   $doc->loadXML($links);
  370.   $parent = $doc->documentElement;
  371.   //check if there's "Read more" in node links only  
  372.   if (sizeof($parent->childNodes) == 1) {
  373.     $element = $parent->firstChild;
  374.     $class = $element->getAttribute("class");
  375.     if (strpos ($class, "read_more") !== FALSE) {
  376.       return FALSE;
  377.     }      
  378.   }
  379.  
  380.   return TRUE;
  381. }
  382.  
Nov 21 '09 #1
1 6467
Atli
5,058 Recognized Expert Expert
Hey.

I would guess you are getting this error because your server is running PHP4, whereas your localhost is running PHP5. Both versions have a DOMDocument object, but they are not used in the same way.

Are you 100% sure this is not the case?
If not, try running the phpinfo() function and checking the version there.
Nov 21 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
8274
by: Dan Finn | last post by:
OpenBSD 3.2 Apache 1.3.26 PHP 4.3.4 PHP-Nuke 6.9 getting these in the apache error log: Sun Nov 16 20:20:16 2003] PHP Notice: Undefined variable: HTTP_USER_AGENT in /htdocs/nuke/html/mainfile.php on line 16 PHP Notice: import_request_variables(): No prefix specified - possible security hazard in
15
2574
by: shablool | last post by:
Hi all, Two distinct compilers give different output for the following code: #include <iostream> #include <string> int main(void) { std::string s("0124"); s.replace(0, 3, s).replace(s.size(), 6, s);
25
3094
by: Nitin Bhardwaj | last post by:
Well, i'm a relatively new into C( strictly speaking : well i'm a student and have been doing & studying C programming for the last 4 years).....and also a regular reader of "comp.lang.c" I don't have a copy of ANSI C89 standard,therefore i had to post this question: What is the difference between "unspecified" behaviour & "undefined" behaviour of some C Code ??
6
2173
by: David N | last post by:
Hi All, What is a best way to handle an undefined value object class that returned from a function. I have a function that call the ADO.NET ExecuteScalar() function and returns the object to the calling function as follow: public object FunctionA() { object RetVal;
1
3111
by: Pavils Jurjans | last post by:
Hello, I am building custom hashtable class, and thinking about value retrieval issues. The thing is, that sometimes the hashtable value may contain value null. If someone is reading this value like this value = myHashtable; then, is the value of "myKey" key is null, then the result is the same, as
49
14516
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On http://www.webreference.com/programming/javascript/gr/column9/ they say: <snip> The undefined property A relatively recent addition to JavaScript is the undefined property.
45
4848
by: VK | last post by:
(see the post by ASM in the original thread; can be seen at <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b> as an option) As that is not in relevance to "new Array() vs " question or to the array performance, I dared to move it to a new thread. Gecko takes undefined value strictly as per Book 4, Chapter 3, Song 9 of Books of ECMA :-)
11
2737
by: Felix Kater | last post by:
Hi, I can compile and run this code (see below) which twice calls the function f, first with too less, second with too much arguments. But is it legal and free of memory leaks and other problems? Of course, I presume that inside f I don't access i in case it was called via g. int f(int i){ /* ... */ return 0; }
9
3273
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this function are of type int. (My question has nothing to do with the definition of the function foo, so don't bother about it.) If I call the function as: foo(2,3,4,5,6,7,8);/*More arguments than expected*/
33
2838
by: coolguyaroundyou | last post by:
Will the following statement invoke undefined behavior : a^=b,b^=a,a^=b ; given that a and b are of int-type ?? Be cautious, I have not written a^=b^=a^=b ; which, of course, is undefined. I am having some confusion with the former statement! Also, state the reason for the statement being undefined!
0
8959
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8784
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9462
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9326
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6747
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6049
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2738
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.