I am working on a blog page (blogview.php) which uses php to get a list of files and dates from a mySQL db and generates a table which lists the blog files and the dates they were created. The goal is that the user will click on the title of a blog and the innerhtml of a cell in another table on the page will change to include the html of the blog file. I'm trying to use js to accomplish the innerhtml change, but although the page looks correct when it opens, I get errors when the page loads, and nothing happens when I click on the blog to be displayed.
The html calling the function is:
where 'bloghere' is the id of the table cell whose innerhtml is supposed to change and 'cwwblog1.txt' is the name of the file whose content will go in the cell.
The code for the js function is:
When I call the page on the web, the error I get when I View Source says
<b>Warning</b>: main(blog_file): failed to open stream: No such file or directory in <b>/home/mydomain/public_html/blogview.php</b> on line <b>20</b><br />
<br />
<b>Warning</b>: main(): Failed opening 'blog_file' for inclusion (include_path='.:/usr/local/lib/php') in <b>/home/mydomain/public_html/blogview.php</b> on line <b>20</b><br />
";
It is true that the file I want to include as the innerhtml is NOT in the directory as the blogview.php directory because blogview.php isn't a driectory.
How do I get the js to correctly open and include the file?
Also, does my el.innerHTML = "<?php include(blog_file); ?>"; statement have correct syntax?
I'll appreciate any help.
The html calling the function is:
Code:
<div onclick="change_content('bloghere','cwwblog1.txt')">
where 'bloghere' is the id of the table cell whose innerhtml is supposed to change and 'cwwblog1.txt' is the name of the file whose content will go in the cell.
The code for the js function is:
Code:
function change_content(id,blog_file) {
if (document.getElementById || document.all) {
var el = document.getElementById? document.getElementById(id): document.all[id];
if (el && typeof el.innerHTML != "undefined") el.innerHTML = "<?php include(blog_file); ?>";
}
}
When I call the page on the web, the error I get when I View Source says
<b>Warning</b>: main(blog_file): failed to open stream: No such file or directory in <b>/home/mydomain/public_html/blogview.php</b> on line <b>20</b><br />
<br />
<b>Warning</b>: main(): Failed opening 'blog_file' for inclusion (include_path='.:/usr/local/lib/php') in <b>/home/mydomain/public_html/blogview.php</b> on line <b>20</b><br />
";
It is true that the file I want to include as the innerhtml is NOT in the directory as the blogview.php directory because blogview.php isn't a driectory.
How do I get the js to correctly open and include the file?
Also, does my el.innerHTML = "<?php include(blog_file); ?>"; statement have correct syntax?
I'll appreciate any help.