Page 1 of 1

A Drop Box, Memberlist Button and Other Problems

Posted: Thu Dec 06, 2007 8:24 pm
by Crazygar
Ok, I am almost complete re-doing a Forum for my Local Saltwater/Marine Aquarists group and wish to add a few things to make things different;

Problem 1;
I removed the "Memberlist" link and turned it into button. How do I make it a "FUNCTION" like {INBOX_IMG} so the button is automatically loaded where it is defined (I have a small window determining logged in --> Memberlist). Where do I place the function and whats the general syntax I have to use to accomplish this?

Problem 2;
I wish to have a drop down box which reads the data from a ".xml" file. The Saltwater/Marine Aquarists group I help run, is strictly and only for people in my region. I have all the Cities and Towns in an ".xml" and wish to use this as a critical part of the new user registration process. I want to know, once again, how to go about accomplishing this.

Problem 3;
I've noticed a few Forums that with each response in a thread, an alternating colour pattern appears. I would really like to have this as well. How or where does one go about to achieve this as well.

Problem 4;
I am working on a "Welcome Page" before you enter the forum. I've often seen them and curious as to how one changes things to load up this way. I would love to use it for general annoucements and newsflashes.

Any help on any of these problems would be greatly appriciated.

Gary

Why read the xml dynamically

Posted: Thu Dec 06, 2007 8:40 pm
by yacahuma
The xml is a static file. So why going to the trouble of reading it? Just have the data in html as a normal select tag. KISS.

Posted: Fri Dec 07, 2007 3:32 am
by Rovas
This forum is made by you or is a product like phpbb3?
If it' s a program you' ll be a better advice on their site.
To do the things you want read some tutorials.
1. Bad ideea. Use sessions to display the form containing the button then use the POST action to display the list.
You can do this using Ajax to display a new div that contains the list.
2. this tutorial one for xml
3. Use php to mark which row you want to color which not by using the class of html tag and then write style for it using css (html tag dot the class name you gave it) and the property

Code: Select all

background
.
4. Use sql interogatins for the latest added items in the tables that contain topics or news.

Posted: Fri Dec 07, 2007 4:13 am
by Crazygar
The xml is a static file. So why going to the trouble of reading it?
Originally it was a .txt file but I figured .xml might be easier. Its not much of a change removing the .xml and hardcoding it to a function call
This forum is made by you or is a product like phpbb3?
If it' s a program you' ll be a better advice on their site.
phpBB2. Unfortunately, I've asked the same questions and usually never get any replies. I found this place, and found that the activity level is far greater and more interactive.

I guess I should take these one at a time. Firstly, I think I would like to define the "Memberlist Button" as a function call. I plan to have it throughout the Forum but as a Button. Which ".php" does this belong in? Functions?

Gary

Posted: Fri Dec 07, 2007 8:10 am
by markusn00b
number 4:

where you echo out the table data cell for your forum, put something like this is:

Code: Select all

$bgcolor = "#E0E0E0"; // light gray  
    $row = mysql_stuff()
      
    while($row = mysql_fetch_array($result)){  
        if ($bgcolor == "#E0E0E0"){  
            $bgcolor = "#FFFFFF";  
        }else{  
            $bgcolor = "#E0E0E0";  
        }  

    echo("<tr bgcolor=".$bgcolor."\"><td>\n");
:)

Posted: Fri Dec 07, 2007 2:05 pm
by Crazygar
Thanks. I'll give it whirl. One silly question... where would I add this to VIEWFORUM.php? I've found where the table data is being retrieved for display, but it does not have an option for background color. Also, I would assume this will override the CSS background color code.

I feel silly asking what might seem basic questions, but I'm just diving into php and its a bit overwhelming. I have not found any really good places to chew my teeth on to build up. A complete reference manual would be lifesaver if one exists.

Gary

Posted: Fri Dec 07, 2007 6:58 pm
by califdon
http://www.w3schools.com/php/default.asp

Some people may disagree with me, but I think you would learn PHP more easily if you studied the language and wrote your own scripts, beginning with simple ones, rather than tweaking little parts of the code of a complex application. The trouble with that is that you never get a solid understanding of how the language works and what the "glue" is that holds it all together. I know that "Hello World" apps are not very exciting, but if your goal is to learn how to write scripts, you really have to start out that way.

Posted: Fri Dec 07, 2007 8:19 pm
by Crazygar
Actually I'm starting to read it over on another Window as I type this. Thanks, looks like a good link. Almost reminds me BASIC 7.0 for the Commodore 128. Either way, I find it rather unusual on how the code is written. One would assume that most of the "GLOBAL" functions would be placed in one location.

I can't seem to find any help or references to any of my questions, just more questions. If you folk would be also kind enough to let me know what file to find or put the code in, it would make it that much easier for me! I'm running Dreamweaver and I am getting a little frustrated that a simple thing can be some complex. Then again, once I learn, it should be second nature for me.

The one thing that is burning my backside is that I want to define a button linked to a function. For instance;

function memberlist_img{}
$memberlist_img{}="img source"

You'd think that creating the function would be simple? I'm not sure where to place "GLOBAL" functions or how to define an IMG function like REPLY_IMG etc etc... Nothing fancy.

Gary

Posted: Fri Dec 07, 2007 9:20 pm
by alex.barylski
OP: Your requests are...vague and impossible to answer technically...

1) Programming cannot be learned over night. 20 some years later and I"m still constantly learning new, faster methods to accomplish the same task I completed yesterday. Seems to be a common misconception.

2) Editing existing software is next to impossible. Even on a small/medium codebase (25,000 lines or less) it took me about a month of study before I could begin making practical changes (user requests). To make matters worse, most software is developed in such a way that if you touch one peice of code, that change will ripple across many other parts of the system.

Trivial, superficial changes like, changing an <a> to a <button> can usually be made with relative ease, but it depends on the supporting system...

For instance, if the link relies on it's href to carry out the action, that can easily be copied and re-implemented inside a button's onclick event. If the application uses a event abstraction layer such as jQuery, you could be in for a mess of a time finding how that link works...changing the code from a <a> to a <button> would likely break your application.

3) Alternating row colors can be implemented in about a million ways...

- Use JavaScript/JQuery to alternate the colors on the client side is like the easy way to "hack" something togather quickly as you don't need to tinker with server code.
- You will need to find the section of responsible for outputing the list you are interested in. This could be inside a template or a class with mangled HTML/PHP/Heredoc, etc...the former is ideal but can lead to more learning issues...

If the template is a static HTML file like many template engines are, then the logic for alternating the colors will not be where you think it is, but instead it's likely done in PHP code which opens/loads/parses and outputs the static HTML template...

HTH

Cheers :)

Posted: Sat Dec 08, 2007 6:57 am
by Crazygar
Ok, maybe I am asking a lot of questions in the first phase of the thread. I do have 4 issues. The snippets of Code are great, but I also would like to know where they get placed.

My original goal was to change a few things around. I removed the "Memberlist" option from the menu as its easy to access with the current bots running around the Net. I wish for the Memberlist option being a button. I have the button defined. I wish to place the "Memberlist Button" at the bottom instead of the "Time Zone" (which I've already done) display in the Main Forum List, Thread Listing, Private Messaging System and a few other spots.

I know that you can define a function by starting out with;

Code: Select all

function memberlist_img{}
$memberlist_img{}="/templates/location/images/memberlist_button.gif"
What I need to know is the proper format for defining a function. Is this all I need above? Or am I missing something? Also, I need to know (what .php) file to place this in. I wish it as a GLOBAL (or site wide) function to be called at anytime! Does this help out.

Yes, I can understand its nothing something you can learn overnight, but I can make rather good leaps and bounds. I think I saw a book on phpBB programming. Though its for phpBB2 (which I am using anyways) I think I'll order it and dive into it. I'm a fast learner. I just need a proper file breakdown. I've found a few sites that are "somewhat" helpful.

Gary