MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old December 20th, 2002, 06:33 PM
sjandreski sjandreski is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 3 sjandreski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
MySql driven menu

I implemented a database driven menu as published in http://www.devarticles.com/art/1/39. Everything works fine except one thing.I have the main webpage that consists of 2 frames--a left or menu frame and the large main frame where all the links open. I specify
Code:
<base target="main">
on the menu.php to open all the links in the main frame, and that works fine. However, one of my links in the menu has to be opened in a new window but no matter what I do I cannot get it to work. I tried
Code:
target="_blank" target=_blank target='blank' target=`blank` target=\"blank\" target="_blank"
but none of this works. How can I fix this? Please help .....

Simon

Reply With Quote
  #2  
Old December 21st, 2002, 09:44 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Simon,

What's the code you're using? It'll help determine the problem.
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #3  
Old December 23rd, 2002, 09:54 AM
sjandreski sjandreski is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 3 sjandreski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK, I figured out what I was doing wrong. I had to define 2 more columns in my table. One for target and one for onclick. Then in php and html code I just made reference to those.

Simon

Reply With Quote
  #4  
Old December 23rd, 2002, 11:37 AM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Would it be possible to paste your code? I'm curious to see how you did it!

Reply With Quote
  #5  
Old December 25th, 2002, 08:46 AM
sjandreski sjandreski is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 3 sjandreski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OK, Please read the article I mentioned in my first post. 99% of the code comes from there, I just changed it a little bit. Remember, I have a framset page of 2 frames -- left and right. The left frame is where this code goes. Additionally, the only modification I made to the menu table (see article) is that I added 2 more columns. One called target and one called onclick. They are both VARCHAR(50). The reason for the addition is so that when I click on a link in the menu I can open the new page in a particular frame or as a new page (hence, the target) and to be able to open 2 frames with one click (hence, the onclick). Here is the code for menu.php. I hope this makes sence, if not, send me a message and I will write a step by step modifications I made.

The relevant portion of the code is this:

Code:
<a href="<?php echo $child[2]; ?>" target="<?php echo $child[4]; ?>" onclick="<?php echo $child[5]; ?>"><?php echo $child[1]; ?></a>


And the rest is here ...
Code:
<?php

	// Create our database connection
	$sqlConn = mysql_connect("localhost", "admin", "somepassword") or die("Couldn't connect to database");
	$dbConn = mysql_select_db("menu", $sqlConn) or die("Couldn't connect to database");
	
	$sql = "select * from nodespnp where parentId = 0 order by nodeId asc";
	$nodeResult = mysql_query($sql) or die("SELECT query failed");
	$counter = 0;
	
?>

<html>
<head>
<title> Dynamic Menus </title>



<base target="right">
<style>

	.root_td
	{
	  background-color: #000000;
	  color: #FFCF00;
	  font-family: Verdana;
	  font-size: 8pt;
	  font-weight: bold;
	  height: 22;
	  padding-left: 5;
	}

	.child_td
	{
	  background-color: #D1D1D1;
	  color: #000000;
	  font-family: Verdana;
	  font-size: 8pt;
	  font-weight: bold;
	  text-decoration: underline;
	  height: 22;
	  padding-left: 10;
	  padding-right: 10;
	  padding-bottom: 3;
	}
	
	body
	{
	  color: #000000;
	  font-family: Verdana;
	  font-size: 8pt;
	  font-weight: normal;
	}
	
	a
	{
	  color: #000000;
	}

</style>
<script language="JavaScript">

	function ToggleNode(nodeObject, imgObject)
		{
			if(nodeObject.style.display == '' || nodeObject.style.display == 'inline')
				{
					nodeObject.style.display = 'none';
					imgObject.src = 'plus.gif';					
				}
			else
				{
					nodeObject.style.display = 'inline';
					imgObject.src = 'minus.gif';
				}
		}

</script>
</head>
<body bgcolor="#FFFFFF">

	<table width="200" border="0" cellspacing="0" cellpadding="0">
	<?php
	
		while($node = mysql_fetch_array($nodeResult))
			{	
	?>
		<tr>
			<td class="root_td">
				<img id="img_root_<?php echo $counter; ?>" onClick="ToggleNode(td_root_<?php echo $counter; ?>, img_root_<?php echo $counter; ?>)" border="0" src="minus.gif" style="cursor:hand">
				&nbsp;<?php echo $node[1]; ?>
			</td>
		</tr>
		<tr>
			<td id="td_root_<?php echo $counter++; ?>" class="child_td">
				<table width="100%">
					<?php
					
						$sql = "select * from nodespnp where parentId = {$node[0]} order by nodeId asc";
						@$childResult = mysql_query($sql);
						
						while($child = mysql_fetch_row($childResult))
							{
						?>
					<tr>
						<td class="child_td">
							<a href="<?php echo $child[2]; ?>" target="<?php echo $child[4]; ?>" onclick="<?php echo $child[5]; ?>"><?php echo $child[1]; ?></a>
						</td>
					</tr>
					
					<?php
						}
					?>
					
				</table>
			</td>
		</tr>
	
	<?php
		}
	?>
	
	</table> 
</body>
</html>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > MySql driven menu


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway