Jump to content

PHP Navigation Generator


jeffkab

Recommended Posts

So I've just taken up PHP and have been hooked on the learning process. I've just got done working a few hours on getting familiar with databases, etc, but now I have a question...

 

I am working on a project in class that has to do with the logic of creating a navigation generator. I've been working around with a flowchart on how to create a horizontal navigation bar with a few links that will be generated via PHP.

 

I will have an .html page where a user can input a specific hexadecimal color code for the color of the buttons, border color, font size, font family, font color, hover stage, etc. Now, as far as I understand, I would create a normal php form that would input this information into specific tables in a database.

 

From here, I would also create a function that outputted the code to the user after he/she inputs the data.

 

Am I on the right track on tackling this project down? Is/Are there any tutorials online similar to creating something along the lines of a generator that plugs information back?

 

Thanks in advance!

Link to comment
Share on other sites

A simple form can regenerate a new look, navigation buttons, whatever. The saving to a DB isn't necessary to pull this off, but if it's part of the class project, then it shouldn't be much more work. So, for the user input, you'll need to be able to create a form in HTML, then learn how to capture the input into PHP variables and act on them. Start there and don't stress over any database stuff right now. Get the form to work, and echo out locally the variables once you process the form. Then move on to the database stuff if you want.

 

A lot of new coders try to learn both at the same time, and honestly, it's a bit much. Take it one step at a time, and you'll retain the information you learn much better.

 

Please take the time and patience to understand code formatting. You will reap the rewards of this every time you have an error that you need to track down, and it will help you formulate logic and actually see the flow. It will also help us answer your questions when you post code that is easy to read.

 

Welcome to PHP!

 

PhREEEk

Link to comment
Share on other sites

If you just want to display the result in the browseryou could try comething like this...

 

 


<style type="text/css">
<!--
.Text {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
font-color:#<?php echo $_GET['textcolor']?>;
}
.button {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
width:<?php echo $_GET['buttonwidth']?>px;
color:#<?php echo $_GET['buttoncolor']?>;
}
.textfield {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
}
-->
</style>


 

this isnt all working just an example

Link to comment
Share on other sites

Awesome! Thanks for the help so far guys.

 

Well, the assignment is to understand the logic of the language and to understand why we take certain approaches at certain projects. So for this specific assignment, we were given a basic horizontal navigation bar. The purpose is to create a navigation bar via PHP and to be able to customize is anytime by having it flexible, expandable, etc.

 

Anything else I should look at?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.