473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

call to undefined function:loadXML()

1
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 6433
Atli
5,058 Expert 4TB
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
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...
15
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,...
25
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...
6
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...
1
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...
49
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...
45
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...
11
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...
9
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...
33
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....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.