7 Replies - 2726 Views - Last Post: 04 November 2010 - 04:22 PM Rate Topic: -----

#1 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Dynamic links in table

Posted 03 November 2010 - 04:36 PM

Hi.. =)

I am trying to learn some php but i have run into a problem..
All the pages on my site should include a topmenu.php and a leftmenu.php. The topmenu.php always have the same links, so no problem there, but my leftmenu.php needs to have a special amount of links(also different links for each site), and a special amount of rows for each site..
Can anybody point me in the right direction? =)
Is This A Good Question/Topic? 0
  • +

Replies To: Dynamic links in table

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2836
  • View blog
  • Posts: 9,740
  • Joined: 08-August 08

Re: Dynamic links in table

Posted 03 November 2010 - 05:50 PM

Your first and biggest problem is that you think your html pages are made up of php "pages." There is no such thing as a php page, only a file. The file or files are executed on the server and the server sends html, some or all of which is generated by php, to the browser. Stop thinking that php and html are the same!
Was This Post Helpful? 0
  • +
  • -

#3 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Dynamic links in table

Posted 04 November 2010 - 12:27 PM

View PostCTphpnwb, on 03 November 2010 - 04:50 PM, said:

Your first and biggest problem is that you think your html pages are made up of php "pages." There is no such thing as a php page, only a file. The file or files are executed on the server and the server sends html, some or all of which is generated by php, to the browser. Stop thinking that php and html are the same!


I have a topMenu.php looking like this, no php code, just .php file
<table id="topMenu"><tr><td><a href="/default.php">Home</a></td>
<td><a href="/link1.php">Tutorials</a></td>
<td><a href="/link2.php">References</a></td>
<td><a href="/link3.php">Examples</a> </td>
<td><a href="/link4.php">About Us</a> </td>
<td><a href="/link5.php">Contact Us</a></td></table>


But i am not really sure what you are meaning?I know php and html aren't the same?
Was This Post Helpful? 0
  • +
  • -

#4 BenignDesign  Icon User is offline

  • holy shitin shishkebobs
  • member icon




Reputation: 5761
  • View blog
  • Posts: 10,080
  • Joined: 28-September 07

Re: Dynamic links in table

Posted 04 November 2010 - 01:25 PM

Don't mind him too much. He gets a little cranky every now and again. :)

If I understand your question correctly, you'll want some php code in that file and link it up to a database or other input file in order to dynamically generate the menu and links.

Your links might look a little like this:

<a href='<?php echo $link; ?>'><?php echo $link_name; ?></a>


This post has been edited by BenignDesign: 04 November 2010 - 01:27 PM

Was This Post Helpful? 0
  • +
  • -

#5 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Dynamic links in table

Posted 04 November 2010 - 01:28 PM

View PostBenignDesign, on 04 November 2010 - 12:25 PM, said:

Don't mind him too much. He gets a little cranky every now and again. :)

If I understand your question correctly, you'll want some php code in that file and link it up to a database or other input file in order to dynamically generate the menu and links.


Not exactly.. I want to write something like

<?php 
include("topmenu.php");
include("leftmenu.php");
?>... 


on my "real" sites, so that they get a top menu and a left menu and the leftmenu.php got dynamic links. =)
Was This Post Helpful? 0
  • +
  • -

#6 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2836
  • View blog
  • Posts: 9,740
  • Joined: 08-August 08

Re: Dynamic links in table

Posted 04 November 2010 - 03:47 PM

That makes no sense. What is topmenu.php? It should be php code, which has nothing to do with any menu position.
You should be doing:
<?php
include("topmenu.html");
include("leftmenu.html");
?>

Those files should contain html elements that will be positioned by your css file.
Was This Post Helpful? 0
  • +
  • -

#7 pepsy11  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 28
  • Joined: 11-October 10

Re: Dynamic links in table

Posted 04 November 2010 - 04:19 PM

View PostCTphpnwb, on 04 November 2010 - 02:47 PM, said:

That makes no sense. What is topmenu.php? It should be php code, which has nothing to do with any menu position.
You should be doing:
<?php
include("topmenu.html");
include("leftmenu.html");
?>


Those files should contain html elements that will be positioned by your css file.


I asked on another forum(some time ago now) about including html files, and they told me that it was only possible to include .php.. i guess i should have dobbelt checked back there..
Okay.. i will change topmenu and leftmenu to .html, but can anybody help me with the links?
Was This Post Helpful? 0
  • +
  • -

#8 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2836
  • View blog
  • Posts: 9,740
  • Joined: 08-August 08

Re: Dynamic links in table

Posted 04 November 2010 - 04:22 PM

You've got the links in a table. I'd put the table (if I was sure I needed it) in a div and give the div a class name or maybe an id. Then it's just a matter of positioning the div correctly with css.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1