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

  • Home
  • SEARCH
  • 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 3958158
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:34:38+00:00 2026-05-20T02:34:38+00:00

This I cant seem to figure out. In a nutshell I have a webpage

  • 0

This I cant seem to figure out. In a nutshell I have a webpage that will change depending on $_GET variables set. When building the webpage there are 2 menus to choose from. These menus are stored in html files.

Here is the line that is reading that file.

$template->set('menu',file_get_contents('../gamefiles/site_menu.html'));

Here is the function that the line is running.

function set($div,$data)
{
    $result = $this->xpath->query("//div[@id = '".$div."']");
    $node = $result->item(0);
    $node->nodeValue = $data;
    $this->dom->saveHTML();
}

Here is what is in the menu file.

<a href=''><div>Home</div></a><br />
<a href=''><div>Documentation</div></a><br />
<a href=''><div>Support</div></a><br />
<a href=''><div>Affiliates</div></a><br />
<a href=''><div>Sign up!</div></a><br />

and here is where my problem is… for some reason its returning

&lt;a href=''&gt;&lt;div&gt;Home&lt;/div&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=''&gt;&lt;div&gt;Documentation&lt;/div&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=''&gt;&lt;div&gt;Support&lt;/div&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=''&gt;&lt;div&gt;Affiliates&lt;/div&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=''&gt;&lt;div&gt;Sign up!&lt;/div&gt;&lt;/a&gt;&lt;br /&gt;

file_get_contents() when used alone returns the correct value which leads me to believe the DOMXPath function is doing something to it. Im pretty stumped.

any ideas? thanks in advance

EDIT

adding construct method that creates DOMDoc

function __CONSTRUCT($template)
{
    $this->dom = new DomDocument();
    $this->dom->loadHTML(file_get_contents($this->template_dir.$template));
    $this->xpath = new DomXPath($this->dom);
}
  • 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-20T02:34:39+00:00Added an answer on May 20, 2026 at 2:34 am

    Not sure what charset you sending in the header, but I’ve run into something similar before and that was the issue. Try using:

    header('Content-Type: text/html; charset=UTF-8');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started making this .php file and i cant seem to figure out
I can't seem to figure out a good way to do this, but it
I can't seem to figure this out. I'm experimenting with MVC Beta and am
This is more of a business-oriented programming question that I can't seem to figure
Hey everyone - I cant seem to figure out what i am doing wrong
I'm building a jQuery navigation and i cant seem to figure out how to
I cant seem to wrap my head around this. I have googled, and overstacked
I have looked all of the place for this and I can't seem to
I want to implement this function on my apps but i cant seem to
I am receiving this error in one of my templates and cant seem to

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.