IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Closed TopicStart new topic
> Need A Programmer, PHP please
AllyGator
post Apr 29 2010, 12:04 PM
Post #1


Map Goddess
Group Icon

Group: Retired Administrator
Posts: 4,622
Joined: 3-July 06
From: Buya
Member No.: 3



I have never claimed to be a programmer. Nexus Atlas needs one just for one short project. We've got so many multi-level caves now. I've love to have the monster information fed from the database. In the past the map pages have been typed in and that's a royal pain in the tush. Over the years, I have rebuild our old database into mySQL and redone almost all of our map pages using php with html templates so that dynamic data comes from the database. Updating only takes seconds now. Except for multi-level caves because I am NOT a programmer. I can, by trial and error sometimes get loops to work but it's really clunky.

Take this page where it loops correctly but there is no in-page link to let you go to the section you want:

http://www.nexusatlas.com/monsters/turtlecave.php

Icespadez made this page and I can't figure out why I can't adapt it to other pages like the one above:

http://www.nexusatlas.com/monsters/anchorite.php

So my biggest problem is map pages where I'd like to just have 1 field repeating for the experience OR if there is a difference in drops per level (and there sometimes is) put up an area with monster images then a brief table with experience and drops but again I can't do loops to save myself:

http://www.nexusatlas.com/50atlas/hunter.php

Can someone volunteer for this job?



--------------------
The hair says it all!
Go to the top of the page
 
+Quote Post
Falaris
post Apr 29 2010, 03:10 PM
Post #2


Oh san
Group Icon

Group: Nobles
Posts: 5,152
Joined: 3-July 06
From: Houston, TX
Member No.: 46
Characters: Falaris, everclear



This is not PHP. What you want to look up is a basic HTML feature called "anchors."

Notice the hyperlink. For example, the page name is "anchorite.php" but then when you mouse-over the links you get a # with some text after it depending on the link. For cave one it is "cl_1" which I'm assuming is short for cave level 1.

Basically all you do is go through the HTML and place a line of code for the anchor, with the name of the anchor in there (in the case above, the anchor name is "cl_1"). When you click the link with #cl_1 after it, it scans the page looking for where the anchor code is. Once it finds it, it scrolls the page down to that point.

So, to first make the link, you use a regular link HTML tag:

CODE
<a href="#anchorname1">LINK TEXT GOES HERE</a>


Ok, voila, the link is done. Now we set the point on the page it goes to with this:

CODE
<a name="anchorname1"></a>


Notice in the name, there is no # in front of the letters, and you still need a closing tag with the /a, but no link text should go inside since you are just using it as a marker on the page for where you want your original link to end up at. Put this piece of code wherever in the page you want to jump to.

For more reference, here is an article.


-Falaris


--------------------
Go to the top of the page
 
+Quote Post
AllyGator
post Apr 29 2010, 06:02 PM
Post #3


Map Goddess
Group Icon

Group: Retired Administrator
Posts: 4,622
Joined: 3-July 06
From: Buya
Member No.: 3



sorry I don't want advise, I'm tired of beating my head, I want a programmer - if it were that simple, I would have done it


--------------------
The hair says it all!
Go to the top of the page
 
+Quote Post
Falaris
post Apr 29 2010, 06:58 PM
Post #4


Oh san
Group Icon

Group: Nobles
Posts: 5,152
Joined: 3-July 06
From: Houston, TX
Member No.: 46
Characters: Falaris, everclear



Fair enough. Maybe next time though you should ask for someone who knows how to copy and paste 1 extra line of code instead of a programmer.


-Falaris


--------------------
Go to the top of the page
 
+Quote Post
Dritz
post Apr 29 2010, 07:08 PM
Post #5


Sam san
Group Icon

Group: Nobles
Posts: 749
Joined: 3-July 06
Member No.: 37
Characters: PyroAce



I think what Ally means is they need someone good at templating which is a tad more complicated. I'd volunteer but I'm not real comfortable with SQL and PHP templates are ugly to look at (XSL all the way!)


--------------------
There I was


Probably not coming back to NF if you'd like to contact me talk to PyroAce in game.
Go to the top of the page
 
+Quote Post
AllyGator
post Apr 29 2010, 10:01 PM
Post #6


Map Goddess
Group Icon

Group: Retired Administrator
Posts: 4,622
Joined: 3-July 06
From: Buya
Member No.: 3



QUOTE (Falaris @ Apr 29 2010, 06:58 PM) *
Fair enough. Maybe next time though you should ask for someone who knows how to copy and paste 1 extra line of code instead of a programmer.


-Falaris


If it were SIMPLE I would have done it. Get the wax out bud. This is not a one line problem. It's not a 20 line problem. It's a conditional loop within a conditional loop within a loop. I think.

Your little example is already used in one of the examples given above. It doesn't solve the problem.


--------------------
The hair says it all!
Go to the top of the page
 
+Quote Post
Alston
post Apr 29 2010, 10:08 PM
Post #7


Sam san
Group Icon

Group: Nobles
Posts: 1,242
Joined: 8-July 09
Member No.: 13,043
Characters: Alston, Dukati... long since dead...



Falaris, you do realize that the html on those pages you see are a result of PHP code working in the background on the server, right? You can't lookup the PHP source itself (trust me on this).


--------------------
- Alston

Find me on any social media by searching for "FSBAlston."
Go to the top of the page
 
+Quote Post
Falaris
post Apr 29 2010, 11:04 PM
Post #8


Oh san
Group Icon

Group: Nobles
Posts: 5,152
Joined: 3-July 06
From: Houston, TX
Member No.: 46
Characters: Falaris, everclear



QUOTE (Alston @ Apr 29 2010, 10:08 PM) *
Falaris, you do realize that the html on those pages you see are a result of PHP code working in the background on the server, right? You can't lookup the PHP source itself (trust me on this).


Yes, I know how it works. She said she is using PHP within HTML templates. I was responding directly to the issue about linking to certain parts of the page. You can put those anchors in an HTML template outside of the PHP tags and have them work, and they would show up in the page source as they normally do since the template is HTML which is NOT generated at the time of the page view and is always static, unlike the stuff inside the PHP tags which generates what you will see as you open the page. What I was talking about did not have to interfere with the PHP at all anyway.

Anyway Ally, nevermind, I'm sorry I tried to help. After re-reading the initial post, it occurred to me that for some reason how the data is being called onto the page is probably much different than how I would do it and I guess I made basic assumptions that it would be done the same way I'd do it from the start, which was wrong of me. None of that really matters though seeing as you don't want advice anyway.


-Falaris


--------------------
Go to the top of the page
 
+Quote Post
Dritz
post Apr 29 2010, 11:15 PM
Post #9


Sam san
Group Icon

Group: Nobles
Posts: 749
Joined: 3-July 06
Member No.: 37
Characters: PyroAce



Not sure what you are trying to say Falaris (never used php to template before) but if you are trying to dynamically create menu options from SQL it could be tough for a newbie.

It should be fairly simple (from my rather limited perspective).

Something like this:

CODE
$array = SQLstuffpointingtosectionheadings

foreach ($array as $heading) {
echo '<a href="#'.$heading.'">'.$heading.'</a>';
}


Personally even that tiny snipit I find hard to read so someone less experienced than me might get confused with a lot of that stuff going on. Using PHP to dynamically generate a lot of html is messy and can be totally unreadable depending on who is writing it.


--------------------
There I was


Probably not coming back to NF if you'd like to contact me talk to PyroAce in game.
Go to the top of the page
 
+Quote Post
Falaris
post Apr 30 2010, 12:05 AM
Post #10


Oh san
Group Icon

Group: Nobles
Posts: 5,152
Joined: 3-July 06
From: Houston, TX
Member No.: 46
Characters: Falaris, everclear



QUOTE (Dritz @ Apr 29 2010, 11:15 PM) *
Not sure what you are trying to say Falaris (never used php to template before) but if you are trying to dynamically create menu options from SQL it could be tough for a newbie.

It should be fairly simple (from my rather limited perspective).

Something like this:

CODE
$array = SQLstuffpointingtosectionheadings

foreach ($array as $heading) {
echo '<a href="#'.$heading.'">'.$heading.'</a>';
}


Personally even that tiny snipit I find hard to read so someone less experienced than me might get confused with a lot of that stuff going on. Using PHP to dynamically generate a lot of html is messy and can be totally unreadable depending on who is writing it.


What you are doing is trying to use PHP to do it, and you're right that it is confusing as it is to me too. I understand it well enough from my experience around web page design and PHP, but I probably couldn't code it nor would I, because I think the problem is that kind of code is an ultra-optimized, professional way of doing it when a simpler method is available for the non-professional PHP programmers who are just working on a fan website.

What I'm saying is that for this particular problem when it comes solely to having links at the top of the page which jump you to a lower part of the page, if the pages are HTML templates, then you should simply put the HTML code in the HTML template outside of the PHP tags rather than doing it via PHP. This shouldn't be hard as the links are at the top. So, you would just enter the HTML in my initial post into the correct spots most likely even before the PHP starts.

The argument could be made that the actual anchors themselves would interrupt the PHP if everything in the right-hand side of the page is generated via PHP with absolutely no use of basic HTML, but even then you would just break the PHP tag at the appropriate places in the HTML template. You could use PHP to do a ton of things to dynamically generate everything and make it much more streamlined than how I am suggesting to code it which is more of only calling for the PHP to input the data I need at specific points and using HTML for the rest, but again we aren't programming Microsoft.com here. Clearly, this is where my lack of PHP ability is showing through as I would opt to not do it that way, but I still think a less confusing approach even at the cost of .0000001ms load time of the page is worth it for a project like this.

The simplest way I can put it is that I would simply make a PHP page, again in an HTML template, that is simply a template of how each "cave level" section looks on those pages. In the HTML table, insert the PHP code in the right places calling for specific information from the MySQL entries with the name of the monster, picture, experience, drops, etc., based on the cave name and level you are calling. From there, any monsters in the database that fall under that entry could have it's data filled in for each monster that is in the database, generated dynamically as you call the page. Of course, the PHP generates the information based on the variable of what cave level and monster you want to call in the first place, which is easy enough if you just name your pages appropriately (if the cave name is "Turtle Cave," then make the page turtlecave.php and each SQL entry's cave name should likewise be 'turtlecave' of course).

I mean, truthfully, I can't even understand why having different drops or experience per cave level is an issue here. For each monster entry in the table, there should be multiple fields created for each monster, including one for cave name and level, along with monster name, experience, drops, etc.

I guess to put what I'm saying in code (not real code, just trying to get the message across without actually designing the page) what I would do based on the Anchorite page:

CODE
<HTML>
<head>
//All the stuff that goes in the head tags which doesn't matter goes here.
</head>

<body>
<table>
<tr><td>
//All the menu code goes here
</td>

<td>
Anchorite<br><br>

<a href="#anchor1">Link to First Anchor on the Page</a> - <a href="#anchor2">Link To The Second Anchor on the Page</a>
<hr>
//All the links for the other caves go here, can do this a few different ways.

<img src="whatever the name of the image that goes across splitting up the top navigation and bottom content sections is.jpg">

<a name="anchor1"></a>
<?php include("monstertablecave1.php"); ?>
//Not getting into the code for variables and getting the correct data, just showing the template and how I would do this
<br>

<a name="anchor2"></a>
<?php include("monstertablecave2.php"); ?>

</td></tr></table>
</body>
</HTML>


Like I said, it is uglier and less streamlined, but more appropriate I think to keep the majority of this as HTML and call the PHP only when you need it to display values from the database. The better you know PHP, the more you can do to not repeat yourself in code or you could even design each "monstertablecave.php" file to have all the anchors and cave levels all in one rather than calling multiple templates, or you could just use the cave level variables to use the same template since all the information for each monster is strictly dependent on the cave and level. I just did it in the most basic way that involved the least bit of PHP that I could. I think it is certainly less confusing for people who don't know PHP, but I might be wrong.


-Falaris


--------------------
Go to the top of the page
 
+Quote Post
AllyGator
post Apr 30 2010, 09:37 AM
Post #11


Map Goddess
Group Icon

Group: Retired Administrator
Posts: 4,622
Joined: 3-July 06
From: Buya
Member No.: 3



It's not a discussion guys, it's a job offer. FYI - I may not be a programmer but I was a unix sys admin for 26 years. So far everything you have said, I have tried plus many, many, many more. My husband is a programmer and used to work for IBM research so he's no slouch and he isn't able to get it working. But he isn't a web programmer and doesn't know PHP. So like I said...

I need someone who knows mySQL and PHP!!!


If you do want to discuss it, I can get Rachel to set up a private forum for us.


--------------------
The hair says it all!
Go to the top of the page
 
+Quote Post
LEET
post May 1 2010, 10:48 AM
Post #12


Ee san
Group Icon

Group: Nobles
Posts: 596
Joined: 6-July 06
Member No.: 170



Paging Dereksmart
Go to the top of the page
 
+Quote Post
Alston
post May 1 2010, 05:18 PM
Post #13


Sam san
Group Icon

Group: Nobles
Posts: 1,242
Joined: 8-July 09
Member No.: 13,043
Characters: Alston, Dukati... long since dead...



I'd help, Ally, but my PHP's so rusty I'd get luckier programming C tongue.gif

I do know php.net has the entire manual up there, and I used to reference it a lot.


--------------------
- Alston

Find me on any social media by searching for "FSBAlston."
Go to the top of the page
 
+Quote Post
Rachel
post May 1 2010, 06:58 PM
Post #14


Oh san
Group Icon

Group: Retired Staff
Posts: 4,874
Joined: 4-July 06
Member No.: 85
Characters: Rachel



Just for the record, a lot of us don't know what we're doing and just figure it out as we go. Willingness to work is often more important than your ability to do so at whatever level you consider to be satsifactory (As long as you can figure enough out to get the job done). Over time, we learn things and fix our earliest mistakes. smile.gif


--------------------
QUOTE
Work continues on the continuation of the Story
Go to the top of the page
 
+Quote Post
DEREKSMART
post May 3 2010, 03:21 AM
Post #15


Enchanted
***

Group: Citizens
Posts: 84
Joined: 24-July 06
Member No.: 471



ok i'll help you out, here i set up a simple db and a test page, based off of the last example you gave (I assume that's how you want it to look?)

http://www.activateskynet.com/images/natest.php

All the relevant data is pulled from the db, which i'm guessing in your example you wrote by hand instead.

Here is the code, it looks ugly because i copy+paste your site's html out to mimic the look

CODE
<?php
$username = "user";
$password = "pass";
$db = "db";

$query = "SELECT * FROM hunter";
?>

<font face="Verdana, Arial, Helvetica, sans-serif" color="#993300" size="1">
   <b>Monsters in Area :</b></font> <br>

        <table width="98%" border="1" cellspacing="0" cellpadding="0" bordercolor="#B1300D">
          <tr>
            <td align=middle bgcolor=#B1300D height=20 width="44%">
              <div align="center">

              <font color="#FEE956" face="Verdana" size="2"><strong>Creature</strong></font></div>
            </td>
            <td align=middle bgcolor=#B1300D height=20 width="27%">
              <div align="center"><font color="#FEE956" face="Verdana" size="2">
              <strong>Experience</strong></font></div>
            </td>
            <td align=middle bgcolor=#B1300D height=20 width="29%">
              <div align="center"><font color="#FEE956" face="Verdana" size="2">
              <strong>Item Drop</strong></font></div>

            </td>
          </tr>
        </table>

        <table width="98%" border="1" cellspacing="0" cellpadding="0"
           bordercolor="#B1300D">


<?php

mysql_connect("localhost", $username, $password) or
    die("Could not connect: " . mysql_error());
mysql_select_db($db);

$result = mysql_query($query);


while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
    
    echo '<tr><td width="24%">
              <div align="center">
  <font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#330000">';
    
    $temp = $row["name"];
    echo '<b>'.$temp.'</b></font></div></td><td width="10%">
              <div align="center">';
    $temp = $row["pic1"];
    echo '<img src="'.$temp.'">';
    echo '<font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#330000">
</font></div>
            </td>
            <td width="10%">
              <div align="center">';
              
    $temp = $row["pic2"];
    echo '<img src="'.$temp.'">';
    echo '<font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#330000">
</font></div>
            </td>
            <td width="27%">
              <div align="center">
  <font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#330000">';
  
    
    $i = 1;
    echo '<b>';
    while($exp = $row["exp".$i])
    {
        if(!$exp)
            break;
        if($i != 1)
            echo '<br>';
        echo "Level $i - $exp";
        $i++;
    }
    
    echo '</b></font></div>
            </td>

            <td width="29%">
              <div align="center">
  <font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="#330000">
              <b>';
    
    $temp = $row["drops"];
    echo "$temp";
    echo '</b></font></div>
            </td>
          </tr>';
}

mysql_free_result($result);
?>

</table>


I made my db very simple for this, especially the item drops field is just a text entry as you can see, i assume yours links to an item table.

If you want me to implement this myself, reply or PM and toss me source and I'll do it according to your db's layout.
Go to the top of the page
 
+Quote Post
AllyGator
post May 3 2010, 04:56 PM
Post #16


Map Goddess
Group Icon

Group: Retired Administrator
Posts: 4,622
Joined: 3-July 06
From: Buya
Member No.: 3



Dereksmart, check your forum mail.


--------------------
The hair says it all!
Go to the top of the page
 
+Quote Post
AllyGator
post May 5 2010, 08:24 PM
Post #17


Map Goddess
Group Icon

Group: Retired Administrator
Posts: 4,622
Joined: 3-July 06
From: Buya
Member No.: 3



I copied most of the files in question to Dereksmart but before he had a chance to look at them I was talking to LordAchoo. The thing with LordAchoo is that he's a really good programmer and that's it's nearly impossible to get him to focus on anything except.....well if you know him you know. Anyway the last time he slowed down enough to work on something for NA was a year ago, then a month ago, AkiKan got him to program the carnage schedule that is now on the front page. I thought we'd have another year before we could bug him again. :heh:

Anyway after I whined enough he solved the problem in an hour.

Compare Anchorite to Magus and Horse Test Page to Mythic Horse. In addition to the breaks between cave levels being clearer, the data is coming directly from the databases now making updates much, much faster.

I've updated the Gogoon Island pages and I'll get to the other leveled caves pretty soon. Hopefully I can get people to give me experience from all cave levels but I doubt that ever happens. Thanks Derek!


--------------------
The hair says it all!
Go to the top of the page
 
+Quote Post
Interstate
post May 6 2010, 04:02 PM
Post #18


Sam san
Group Icon

Group: Nobles
Posts: 905
Joined: 24-June 07
From: California
Member No.: 2,663



lol.... just, lol.

Poor allygator. Way to hold the nexus together girl.




--------------------
Vicious Circle
Hater of haters
Anti-elitist elitist

http://www.youtube.com/watch?v=BwL65cvzK0s...feature=related
Go to the top of the page
 
+Quote Post
stabme
post Jun 4 2010, 08:21 PM
Post #19


Sam san
Group Icon

Group: Nobles
Posts: 907
Joined: 4-July 06
Member No.: 66



dude, wth falaris what are you talking about. not a single person in this thread knows wth they're talking about re: html, php, templating, mysql, loops, tyvm.

pls, ffs, give me your code/project and i'll whip it to you in a much more optimized, faster, and easier way to you by this weekend. this is ridic.

how many mysql tables in nexus atlas, or rather the hunting, maps and experience tables? what do you say if i say i can auto generate all your content for you without having to make a new php page again.


--------------------
IMEDIAT: I am the Lixir! I speak for the Wars!
I no longer Elixir or draw Imediat. I now help make music free for all: Grooveshark
Go to the top of the page
 
+Quote Post
AllyGator
post Jun 4 2010, 10:01 PM
Post #20


Map Goddess
Group Icon

Group: Retired Administrator
Posts: 4,622
Joined: 3-July 06
From: Buya
Member No.: 3



QUOTE (stabme @ Jun 4 2010, 08:21 PM) *
dude, wth falaris what are you talking about. not a single person in this thread knows wth they're talking about re: html, php, templating, mysql, loops, tyvm.

pls, ffs, give me your code/project and i'll whip it to you in a much more optimized, faster, and easier way to you by this weekend. this is ridic.

how many mysql tables in nexus atlas, or rather the hunting, maps and experience tables? what do you say if i say i can auto generate all your content for you without having to make a new php page again.


There are several databases but only 2 that count. One for Nexus Forums and one for everything else. The rest are test stuff. No tables for maps are in use although I've set up stuff for NPCs, rooms, areas, locations, etc. I just never found a real reason to use them. I cross reference locations to areas for the cave requirement chart and minor quest chart but that's about it. If the a map's monster graphic background is darker grey then the data is from the database - otherwise not. For example - Mythic maps don't use the database...yet. I'll get to it one day.


--------------------
The hair says it all!
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 20th October 2017 - 09:16 AM
Nexus Forums is part of: Nexus Atlas © all rights reserved.