Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6357897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:15:43+00:00 2026-05-24T23:15:43+00:00

This script should change the TOP value of the specified COMMUNITY node. But it

  • 0

This script should change the TOP value of the specified COMMUNITY node. But it doesn’t what could be wrong?

<?php

function make_update( $nodeid, $name, $top, $left, $width, $height ) {

$nodes = new SimpleXMLElement('communities.xml', null, true);

$node = $nodes->xpath("//COMMUNITY[@ID='$nodeid']"); 

$node->TOP->nodeValue = $top;

$nodes->asXML();

return $top;
}

echo make_update(trim($_REQUEST['nodeid']),trim($_REQUEST['name']),trim($_REQUEST['top']),trim($_REQUEST['left']),trim($_REQUEST

['width']),trim($_REQUEST['height']));

?>

The XML looks like this.

<?xml version="1.0" encoding="ISO-8859-1"?>
<COMMUNITIES>
<COMMUNITY ID="c001">
  <NAME>Town Services</NAME> 
  <TOP>50</TOP> 
  <LEFT>50</LEFT> 
  <WIDTH>200</WIDTH> 
  <HEIGHT>300</HEIGHT> 
  <URLS>
      <URL ID="U001">
          <NAME>Google.com</NAME>
          <URLC>http://www.google.com</URLC>
      </URL>
      <URL ID="U002">
          <NAME>Bing.com</NAME>
          <URLC>http://www.bing.com</URLC>
      </URL>
      <URL ID="U003">
          <NAME>Yahoo.com</NAME>
          <URLC>http://www.yahoo.com</URLC>
      </URL>
      <URL ID="U004">
          <NAME>Aol.com</NAME>
          <URLC>http://www.aol.com</URLC>
      </URL>
  </URLS> 
  </COMMUNITY>
</COMMUNITIES>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:15:44+00:00Added an answer on May 24, 2026 at 11:15 pm

    First, you should adjust the code that gets the desired COMMUNITY element. The xpath method returns an array of SimpleXMLElement objects, representing the elements that matched your search string.

    Example:

    $returnArray = $nodes->xpath("//COMMUNITY[@ID='$nodeid']"); 
    $node = $returnArray[0];
    

    Second, to modify the value of the TOP element, set directly to TOP itself:

    // This replaces the contents of the TOP element with $top
    $node->TOP = $top;
    
    // This appends '<nodeValue>$top</nodeValue>' to the contents of TOP
    $node->TOP->nodeValue = $top;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this script to display all the images in a folder, but I
I got this script called rapidshare link checker v2 php by Bigfish At the
I've got this script on my website : $(document).ready(function() { function filterPath(string) { return
This script sets a random color to the body and a div and should
First let me explain that I have this script that should let users enter
$(document).ready(function() { $('#comment textarea').click(function() { if (this.value == this.'Post a comment') { this.value =
Please help to prepare batch script on DOS. This script should run in following
When building code like this: <script type=text/javascript src=<%=ResolveUrl(~/js/js.js)%>></script> or <input type=image src=<%=ResolveUrl(~/img/submit.png)%> /> Should
For this script, it checks to see if the file is a microsoft words
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.