Hmm I'm a bit confused.
Based on your code, if I were to replace lesson with fv, and number with 01, wouldn't that replace all places that said {LESSON} or {NUMBER}?
Here is a larger chunk of the actual HTML code...
Code: Select all
<table class="vocab">
<tr>
<th>Korean</th>
<th>English</th>
</tr>
<tr>
<td>네</td>
<td>yes</td>
<td><div id="fv01"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so01 = new SWFObject("../flash/small_button_template.swf", "fv01", "24", "24", "8", "#ffffcc");
so01.addVariable("audioName","audio/fv01.mp3");
so01.write("fv01");
</script>
</td>
</tr>
<tr>
<td>아니오</td>
<td>no</td>
<td><div id="fv02"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so02 = new SWFObject("../flash/small_button_template.swf", "fv02", "24", "24", "8", "#ffffcc");
so02.addVariable("audioName","audio/fv02.mp3");
so02.write("fv02");
</script>
</td>
</tr>
<tr>
<td>안녕하세요</td>
<td>hello</td>
<td><div id="fv03"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so03 = new SWFObject("../flash/small_button_template.swf", "fv03", "24", "24", "8", "#ffffcc");
so03.addVariable("audioName","audio/fv03.mp3");
so03.write("fv03");
</script>
</td>
</tr>
<tr>
<td>안녕히 가세요*</td>
<td>goodbye</td>
<td><div id="fv04"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so04 = new SWFObject("../flash/small_button_template2.swf", "fv04", "24", "24", "8", "#ffffcc");
so04.addVariable("audioName","audio/fv04.mp3");
so04.write("fv04");
</script>
</td>
</tr>
<tr>
<td>안녕히 계세요*</td>
<td>goodbye</td>
<td><div id="fv05"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so05 = new SWFObject("../flash/small_button_template.swf", "fv05", "24", "24", "8", "#ffffcc");
so05.addVariable("audioName","audio/fv05.mp3");
so05.write("fv05");
</script>
</td>
</tr>
<tr>
<td>감사합니다*</td>
<td>thank you</td>
<td><div id="fv06"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so06 = new SWFObject("../flash/small_button_template.swf", "fv06", "24", "24", "8", "#ffffcc");
so06.addVariable("audioName","audio/fv06.mp3");
so06.write("fv06");
</script>
</td>
</tr>
<tr>
<td>고맙습니다*</td>
<td>thank you</td>
<td><div id="fv07"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so07 = new SWFObject("../flash/small_button_template.swf", "fv07", "24", "24", "8", "#ffffcc");
so07.addVariable("audioName","audio/fv07.mp3");
so07.write("fv07");
</script>
</td>
</tr>
<tr>
<td>괜찮아요</td>
<td>it's alright / your welcome</td>
<td><div id="fv08"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so08 = new SWFObject("../flash/small_button_template.swf", "fv08", "24", "24", "8", "#ffffcc");
so08.addVariable("audioName","audio/fv08.mp3");
so08.write("fv08");
</script>
</td>
</tr>
<tr>
<td>미안해요</td>
<td>I'm sorry</td>
<td><div id="fv09"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so09 = new SWFObject("../flash/small_button_template.swf", "fv09", "24", "24", "8", "#ffffcc");
so09.addVariable("audioName","audio/fv09.mp3");
so09.write("fv09");
</script>
</td>
</tr>
<tr>
<td>실례합니다</td>
<td>excuse me</td>
<td><div id="fv10"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so10 = new SWFObject("../flash/small_button_template.swf", "fv10", "24", "24", "8", "#ffffcc");
so10.addVariable("audioName","audio/fv10.mp3");
so10.write("fv10");
</script>
</td>
</tr>
<tr>
<td>그래요</td>
<td>really? is that so?</td>
<td><div id="fv11"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so11 = new SWFObject("../flash/small_button_template.swf", "fv11", "24", "24", "8", "#ffffcc");
so11.addVariable("audioName","audio/fv11.mp3");
so11.write("fv11");
</script>
</td>
</tr>
<tr>
<td>뭐</td>
<td>what</td>
<td><div id="fv12"><a href="http://www.learn-korean-now.com/flash_update.php">Update Flash</a></div>
<script type="text/javascript">
var so12 = new SWFObject("../flash/small_button_template.swf", "fv12", "24", "24", "8", "#ffffcc");
so12.addVariable("audioName","audio/fv12.mp3");
so12.write("fv12");
</script>
</td>
</tr>
</table>
All of this, (plus more using the same pattern), is stored in a MySQL database specific row and column. I want to speed up the process of changing all those values from fv01 to fv02 to fv03, etc...Otherwise it takes forever. I cannot simply make one change to lesson/number for each page, or else the same audio file would be played every time. I need to be able to change number every time I use that Javascript code on the page, but don't want to have to change it 7 times within the Javascript. I would prefer to only make the change once each time I use the Javascript and have that change be reproduced in the Javascript itself.
When I create a page, it searches the database for the row that has the same pagename, and then finds the column titled 'body'. That is where the HTML body is found, which is where all this would be located.
Here is the main chunk of the PHP code used to create pages...each echo row[1] or echo row[2] is referring to parts of the site. The first few build the navbar. Then another builds a news section at the top of the site, another the login section, and another builds the body. The body is what I'm interested in here.
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title>Learn Korean Now</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" href="http://www.learn-korean-now.com/files/class.css" type="text/css" />
<?php
if ($prompt === "1"){
echo "<script language=\"JavaScript\">";
echo "alert(\"This page has been installed into the database.\");";
echo "</script>";
}
?>
</head>
<body>
<div id="wrapper">
<table width="725" cellspacing="0" cellpadding="0" border="0">
<tr><td colspan="2"><img src="http://www.learn-korean-now.com/files/imgs/header.jpg" alt="" /></td></tr>
<tr><td width="170" valign="top" background="http://www.learn-korean-now.com/files/imgs/columnbg.jpg">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td><img src="http://www.learn-korean-now.com/files/imgs/1_top.jpg" alt="" /></td></tr>
<tr><td background="http://www.learn-korean-now.com/files/imgs/1bg.jpg">
<!-- Iterate the links down and repeat the bg -->
<?php
$query = "SELECT * FROM site_info WHERE pagename = '$filename'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo $row[1];
?>
</td></tr>
<tr><td><img src="http://www.learn-korean-now.com/files/imgs/1_bot.jpg" alt="" /></td></tr>
<tr><td><img src="http://www.learn-korean-now.com/files/imgs/2_top.jpg" alt="" /></td></tr>
<tr><td background="http://www.learn-korean-now.com/files/imgs/linkbg.jpg">
<!-- Iterate the links down and repeat the bg -->
<?php
$query = "SELECT * FROM site_info WHERE pagename = '$filename'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo $row[2];
?>
</td></tr>
<tr><td><img src="http://www.learn-korean-now.com/files/imgs/2_bot.jpg" alt="" /></td></tr>
<tr><td><img src="http://www.learn-korean-now.com/files/imgs/3_top.jpg" alt="" /></td></tr>
<tr><td background="http://www.learn-korean-now.com/files/imgs/linkbg.jpg">
<!-- Iterate the links down and repeat the bg -->
<?php
$query = "SELECT * FROM site_info WHERE pagename = '$filename'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo $row[3];
?>
</td></tr>
<tr><td><img src="http://www.learn-korean-now.com/files/imgs/3_bot.jpg" alt="" /></td></tr>
<tr><td><img src="http://www.learn-korean-now.com/files/imgs/4_top.jpg" alt="" /></td></tr>
<tr><td background="http://www.learn-korean-now.com/files/imgs/linkbg.jpg">
<!-- Iterate the links down and repeat the bg -->
<?php
$query = "SELECT * FROM site_info WHERE pagename = '$filename'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo $row[4];
?>
</td></tr> <tr><td><img src="http://www.learn-korean-now.com/files/imgs/4_bot.jpg" alt="" /></td></tr>
</table>
</td>
<td width="555" valign="top">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td width="374" height="165" valign="top" background="http://www.learn-korean-now.com/files/imgs/news.jpg">
<div class="news">
<?php
$query = "SELECT * FROM site_info WHERE pagename = '$filename'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo $row[5];
?>
</div>
<div class="title">
<?php
$query = "SELECT * FROM site_info WHERE pagename = '$filename'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo $row[7];
?>
</div>
</td>
<td width="181" height="165" valign="top" background="http://www.learn-korean-now.com/files/imgs/login.jpg">
<?php
if(!isset($_SESSION['user_id'])) {
$query = "SELECT * FROM site_info WHERE pagename = '$filename'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo $row[6];
} else {
echo "<div style=\"margin-left: 20px; margin-top: 30px; \">";
if($_SESSION['member'] == 1) {
echo "Welcome Back, <br /> <b>{$_SESSION['username']}</b>!";
} else {
echo "Welcome To <br />Learn Korean Now, <b>{$_SESSION['username']}</b>";
}
echo "<form action=\"../phpBB2/login.php". $_SESSION['sid'] ."\" method=\"POST\">
<input type=\"hidden\" name=\"redirect\" value=\"../index.php\">
<input type=\"submit\" name=\"logout\" value=\"Logout\">
</form>";
echo "</div>";
}
?>
</td></tr>
</table>
</td></tr>
<tr><td>
<div class="body">
<?php
$query = "SELECT * FROM site_info WHERE pagename = '$filename'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo $row[8];
?>
</div>
</td></tr>
</table>
</td>
</tr>
</table>
<img src="http://www.learn-korean-now.com/files/imgs/footer.jpg" alt="Copyright Learn Korean Now" /><br />
</div>
</body>
</html>
When I tried using PHP to do this, it didn't process the PHP, but came out like the following little snippet in the HTML source code...
Code: Select all
<td><?php
$lesson = "fv";
$number = 03;
include("../flash/audio_swfobject_include.php");
?></td>
<td>어머니</td>
<td>mother</td>
</tr>
<tr>
<td><?php
$lesson = "fv";
$number = 04;
include("../flash/audio_swfobject_include.php");
?></td>