Jump to content

horsebox

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

horsebox's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. litebearer: I'll try that now thanks. BTW I like your signature "The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture" I think mainly in pictures so I'm a big picture thinker myself too. Probably why I like programming so much because with programming when you learn the basics you can start putting things together and building functions. You can start putting your functions together and building applications. You can start putting your applications together and building huge multipurpose programs.
  2. 1 of the main things I do when I log into a forum account is read old threads I made because I don't always read the replies at once. I can't even find a link to a control panel let alone a link to my old posts so I have to find a thread I posted in, click on my username then click "Find all posts by horsebox". Up the top left corner there are 2 links # Show unread posts since last visit. # Show new replies to your posts. there should be a link "Show all of your threads" and there should be a Control Panel link in the main panel next to Home.
  3. TeddyKiller: Yeah thats what I'm talking about for example the string will be "TEXT~T~FUNCTION~T~TEXT~T~FUNCTION~T~TEXT" so when I explode it all the odd numbered array elements are text to be echoed and the even numbers are functions to be executed.
  4. I have a simple BBCode system but there are a few special tags that need to run PHP functions so what I do is I explode the text field like this $br_pieces = explode('~T~',$replace); for ($ibr=0; $ibr<=10; $ibr++) { if ($ibr % 2) { $br_number = "odd"; } else { $br_number = "even"; } if ($br_number == "even") { echo $br_pieces[$ibr]; } else { php_function($br_pieces[$ibr]); } } } It works but this method is causing me problems. When I explode the variable there may be anywhere from 2 to 20 parts and as you can see even numbers is text to be echoed and odd numbers are functions to be executed. I have to systematically process every piece of the exploded variable. What kinda loop would you use for this? I only really know how to use for loops but they don't seem to be the right type of loop for this kinda thing. Either that or I just cant use them properly.
  5. I don't really know how to use loops I've been using the for loop for everything but I keep running into the same problem. When I need to do something once inside the loop like for example echo $variable it does it 50 times because its inside the loop. How do you do something only once when you're inside a loop thats set to repeat multiple times? For example say I have the loop for ($ibr=0; $ibr<=10; $ibr++) { $var[$ibr] = $ibr + 4; echo $variable; } or whatever and need to repeat the $ibr + 4 part 10 times but only need to echo the $variable once what would I do? The way it is there it will echo the $variable 10 times.
  6. All the tutorials I found seemed to be overkill, pages of code for something as simple as setting up LaTeX. If anyone here has setup LaTeX on their webserver can you give me the bare minimum code needed to interact with it.
  7. I just started using GD yesterday and I've been trying to make a decent graph generator but I'm having serious trouble http://toxicopoeia.com/test.php I just got a template for a dead basic graph generator and my plan was to modify it and turn it into a proper graph generator and function grapher but I'm stuck. Heres the code. test.php <? function getvars($var) { $cleaned = preg_replace("[^A-Za-z 0-9\/]", "", $_POST["$var"]); return $cleaned; } if (isset($_POST['dimensions']) and $_POST['dimensions'] > 0) { $dimensions = (int)$_POST['dimensions']; } else { $dimensions = 10; } if (isset($_POST['x_property'])) { $x_property = getvars("x_property"); } else { $x_property = "Property"; } if (isset($_POST['x_unit'])) { $x_unit = getvars("x_unit"); } else { $x_unit = "Unit"; } if (isset($_POST['y_property'])) { $y_property = getvars("y_property"); } else { $y_property = "Property"; } if (isset($_POST['y_unit'])) { $y_unit = getvars("y_unit"); } else { $y_unit = "Unit"; } if (isset($_POST['x_increment']) and $_POST['x_increment'] > 0) { $x_increment = (int)$_POST['x_increment']; } else { $x_increment = 1; } if (isset($_POST['y_increment']) and $_POST['y_increment'] > 0) { $y_increment = (int)$_POST['y_increment']; } else { $y_increment = 1; } if (isset($_POST['x_start']) and $_POST['x_start'] > 0) { $x_start = (int)$_POST['x_start']; } else { $x_start = 1; } if (isset($_POST['x_end']) and $_POST['x_end'] > 0) { $x_end = (int)$_POST['x_end']; } else { $x_end = $dimensions; } if (isset($_POST['y_start']) and $_POST['y_start'] > 0) { $y_start = (int)$_POST['y_start']; } else { $y_start = 1; } if (isset($_POST['y_end']) and $_POST['y_end'] > 0) { $y_end = (int)$_POST['y_end']; } else { $y_end = $dimensions; } echo ' <form action="test.php" method="post" name="graph"> Dimensions <input type="text" name="dimensions" size="2" maxlength="2" value=' . $dimensions . '><br> X Property <input type="text" name="x_property" size="10" maxlength="15" value=' . $x_property . '> Unit <input type="text" name="x_unit" size="5" maxlength="10" value=' . $x_unit . '><br> Y Property <input type="text" name="y_property" size="10" maxlength="15" value=' . $y_property . '> Unit <input type="text" name="y_unit" size="5" maxlength="10" value=' . $y_unit . '><br> X-Range <input type="text" name="x_start" size="2" maxlength="2" value=' . $x_start . '> to <input type="text" name="x_end" size="2" maxlength="2" value=' . $x_end . '><br> Y-Range <input type="text" name="y_start" size="2" maxlength="2" value=' . $y_start . '> to <input type="text" name="y_end" size="2" maxlength="2" value=' . $y_end . '><br> X-Increment <input type="text" name="x_increment" size="2" maxlength="2" value=' . $x_increment . '><br> Y-Increment <input type="text" name="y_increment" size="2" maxlength="2" value=' . $y_increment . '><br> <input type="submit" name="go"></form><br> <img src="grid2.php?dimensions='; echo "$dimensions&points=$points&x_property=$x_property&x_unit=$x_unit&y_property=$y_property&y_unit=$y_unit &x_increment=$x_increment&y_increment=$y_increment&x_start=$x_start&x_end=$x_end&y_start=$y_start&y_end=$y_end&font=Abbeyline.ttf"; echo '" /><br><br>'; ?> grid2.php: $dimensions = (int)$_GET['dimensions']; $x_increment = (int)$_GET['x_increment']; $y_increment = (int)$_GET['y_increment']; $x_property = getvars("x_property"); $x_unit = getvars("x_unit"); $y_property = getvars("y_property"); $y_unit = getvars("y_unit"); $dim = $dimensions * 25; $dim2 = $dim - 1; $dim3 = $dimensions + 1; $x_offset2 = 50; $x_offset = 25; $y_offset = 7; $xi = 1; $yi = $dimensions; $points = "0 0, 0 0, 1 4, 2 7, 3 8, 4 5, 8 7, 7 15, 25 19"; $p = explode(", ",$points); $pcount = count($p) - 1; for ($i=0; $i<$pcount+1; $i++){ if (isset($p[$i])) { $p2 = explode(" ",$p[$i]); $x[$i] = $p2[0] * 25; $y[$i] = $p2[1] * 25; } } // Define .PNG image header("Content-type: image/png"); $imgWidth=$dim + 80; $imgHeight=$dim + 50; // Create image and define colors $image=imagecreate($imgWidth, $imgHeight); $colorWhite=imagecolorallocate($image, 255, 255, 255); $colorGrey=imagecolorallocate($image, 192, 192, 192); $colorBlue=imagecolorallocate($image, 0, 0, 255); $colorRed=imagecolorallocate($image, 255, 0, 0); $colorGreen=imagecolorallocate($image, 0, 150, 0); $colorBlack=imagecolorallocate($image, 0, 0, 0); // Set the line thickness to 5 // Create border around image imagesetthickness($image, 3); imageline($image, $x_offset-1, 0, $x_offset-1, $dim, $colorRed); imagesetthickness($image, 1); imageline($image, $x_offset, 0, $dim + $x_offset, 0, $colorBlack); imageline($image, $dim2 + $x_offset, 0, $dim2 + $x_offset, $dim2, $colorBlack); imagesetthickness($image, 3); imageline($image, $x_offset, $dim2, $dim2 + $x_offset, $dim2, $colorBlack); // Create grid imagesetthickness($image, 1); for ($i=1; $i<$dim3; $i++){ // Y Axis imageline($image, $i*25, 0, $i*25, $dim, $colorBlack); imagestring($image,3,25,$y_offset-10,$yi,$colorBlack); // X Axis imageline($image, $x_offset, $i*25, $dim + $x_offset, $i*25, $colorBlack); imagestring($image,3,15,$imgHeight-25,0,$colorBlack); imagestring($image,3,$x_offset2-2,$imgHeight-35,$xi,$colorBlack); $x_offset2 += 25; $y_offset += 25; $xi = $xi + $x_increment; $yi = $yi - $y_increment; } imagestring($image,5,($dim/2)-40,$imgHeight-18,"$x_property ($x_unit)",$colorGreen); imagestringup($image,5,1,($y_offset/2)+40,"$y_property ($y_unit)",$colorGreen); // Create line graph imagesetthickness($image, 2); for ($i=2; $i<$pcount; $i++){ imageline($image, $x[$i], ($dim-$y[$i]), $x[$i+1], ($dim-$y[$i+1]), $colorBlue); } // Output graph and clear image from memory imagepng($image); imagedestroy($image);[/code] Anyone know a better method of doing this? Sooner or later I'm gonna have to make it display curves rather than just straight lines so in order to do that I'm guessing I have to make a load of tiny lines which contantly change slope as they approach the plotted point. Right now the lines are all made in multiples of 25.
  8. Holy shit yeah I just looked at it with epiphany. The problem was the <hr>'s. Its fixed now.
  9. Yeah I'm trying to figure out how to make the link turn bright green while the text turns white when the TD changes on rollover. I never thought about expanding and collapsing the side menus. Thats exactly what I'm gonna do thanks. I always thought the bright green rollovers looked good but its about time I made a new menu anyway. I'm thinking of making an interactive menu with pictures that expands on rollover like someone above suggested. I have serious trouble making nice looking forms. If you register an account you'll see plenty more input forms but none of them look any better than the registration form. Thanks. I'm a beginner when it comes to making banners so I've been putting it off for a long time. The name in the banner is the old name of the site so I'd say its about time I made a new one. Do you know any simple methods of making nice looking banners? Took me ages to make that one with photoshop.
  10. I have 3 database tables a plants table, a chemicals table and a preparations table. Some plants have chemicals in them and there are preparations that can be made from them. I need a way to cross reference them to keep track of which chemicals are present in which plants and preparations and which preparations contain which chemicals and plants etc. What I did right now is add a preparations field and a chemicals field to the plants table. A plants field and a preps field to the chemicals table etc. In these fields I list the ID number of the items to be cross referenced. Is there a simpler and more effective way to do this? I'd really rather not have these extra fields in each table I've heard of people creating separate tables for cross referencing. is that the most effective way to do it?
  11. How do I make the link color different to the text color though. I need to leave the link green and the text black and on rollover the link bright green and the text white. The "color" command will only code for the color of one of them.
  12. I have a table and the td's switch between two classes with this onmouseover="className='navon'" onmouseout="className='navoff'" so that the background color changes when you hover over them. Take a look http://toxicopoeia.com/ hover over that latest articles table. Problem is the links don't look good with that dark gray background so I need to make them brighter. What would be the easiest way to get the links to change color too?
  13. Yeah erowids the one site I've been trying to catch up with since I started the site. The only other good site like it I know it lycaeum.org but they don't even update that site anymore.
  14. Took a long time to load for me but holy shit thats a nice site.
  15. http://www.toxicopoeia.com I'm far from a professional webmaster but can anyone recommend some things I can modify to make the site look better. The site has some serious content and I've done heavy PHP programming but the design is pretty much the same as when someone on this site made a CSS document for me years ago.
×
×
  • 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.