-
Posts
1,008 -
Joined
-
Last visited
Everything posted by spiderwell
-
Object works in index.php but not in the extended class
spiderwell replied to The Little Guy's topic in PHP Coding Help
i experienced the very same problem last week -
no i have one list, and its got divs in each <li> for layout, but nested lists would work just as well i guess
-
hey no worrys dude, i took it as a joke i am wondering now though if tables have other properties that enhance data grids, that I am not aware of. perhaps via DOM they do?
-
How to?Button shows up in the page like youtube
spiderwell replied to TheUninvited's topic in HTML Help
you would implement ajax to pass the comment to the database and then update the page inline on success, avoiding a page submit -
well i fancied trying to make a table free site and this is what i ended up with. i guess its personal preference really.
-
I'm not sure if that was aimed at me or the other guy. Tables would deffo have to be used if col/row spanning was required
-
here comes the irony, pass it to a string and use rtrim() (trims space from the right) you could probably do that directly into the echo statement too though, I just want you to use strings
-
haha i just noticed i have 'moo' echoed in the pageination bit, aha was debugging
-
this is what I get using lists instead of tables, nice straight columns : [attachment deleted by admin]
-
if you dont want to try the string method why not just echo out a period after the loop ends the sentence? or is it looping several sentences in a row?
-
a long time ago, on a computer far far away, I used tables for almost all my html layout, especially forms and datagrids (page of database rows/columns). Tables however seem to be seen as the devil these days, and css is encouraged with div tags or whatever. however the table is such an obvious thing for forms or datagrids. I pretty much dropped tables from my code except for those 2 examples, however i had one day an idea to put everything in lists (mostly because I was mucking around with drag and drop thumbnail lists). I find now that a well structured css applied to a <ul> can look just as good if not better than a table equivlent, and if I have anything that I know will warrant that kind of layout will now always opt for that as an alternative to using tables. it also gives me a bonus of allowing drag/drop ordering quite easily. What are other peoples thoughts on lists vs tables for such layouts?
-
not sure i can work out where the sentences start and end but maybe passing the output to a concatenating string and then add it to the final string?
-
theres always more than one way to skin a cat, here is my effort, I made functions rather than just procedural code. I was thinking of adding a css bit which outputs colored divs to simulate a rainbow, but perhaps later... <?php //functions function startgame(){ if (isset($_SESSION['rainbow'])) unset($_SESSION['rainbow']); $_SESSION['rainbow'] = array("red"=>0,"orange"=>0,"yellow"=>0,"green"=>0,"blue"=>0,"indigo"=>0,"violet"=>0); } function checkcolor($color){ if(array_key_exists($color, $_SESSION['rainbow'])){ if($_SESSION['rainbow'][$color] == 0){ $_SESSION['rainbow'][$color] = 1; if(array_sum($_SESSION['rainbow'] ) == 7){ return "you have guessed all colors correctly"; //you could reset session varialbe here too, to auto reset the game. } else { return "you need " . (7 - array_sum($_SESSION['rainbow'] )) . " more color(s) to finish."; } } else { return "You already chose this color, please try again"; } } else { return "The color " . $color . " is not in the rainbow"; } } //runtime session_start(); $output = ""; if (!isset($_SESSION['rainbow']) || isset($_GET['reset'])){ startgame();} if (isset($_POST['color']) && $_POST['color'] <> "") { $output = checkcolor($_POST['color']); } else { $output = "nothing was entered"; } ?> <!DOCTYPE HTML> <html> <head> <title>I can see a rainbow</title> <style> body {font-family:arial;} </style> </head> <body> Do you know all the colors in the rainbow?<br><br> <?php echo $output; ?> <form name="input" action="rainbow.php" method="POST"> Color: <input type="text" name="color" value="" > <input type="submit" value="Guess!" name ="guess"> </form> <a href="rainbow.php?reset=1">Start over</a> </body> </html>
-
Can you recommend a good place to do PHP exercises?
spiderwell replied to KyZu's topic in Miscellaneous
just NO. they have a lot of incorrect information, but that said it has good explanations, just a pity its not always accurate. -
super simple, if( $v_name == "" || $v_msg == "" ) into a switch?
spiderwell replied to phpchick's topic in PHP Coding Help
We all began somewhere, no one is born with ultimate knowledge of PHP. I was born with it, buy my ma dropped me on my head :'( and that was that, no more php, so here I am in a help forum.... -
reading this post, my mind is thinking of an alternative method/solution. I might give it ago in the morning (3am here) but essentially it involves 1 session object which is an array of keys being the colours and values all being 0 (at start of game), and then update each value to 1 when the colour(session array key) is posted in the form, and of course the usual checks to clarify if its been chosen already or not. it avoids the maths part at any rate
-
eh? you mean the wc3 validator? it doesnt validate php anyway
-
Passing array from php to javascript using html button
spiderwell replied to ajeesh.tr's topic in Javascript Help
you would have to create php code to echo out javascript code to do it, this function below is from a site i made (for fun!) and it takes a list form a database, and spits it out in different formats, www.copyandpastelists.com if you look i am using the php to write a small javascript array with values from a php dataset from mysql you should be able to acheive what you want in this manner, but of course it will need a rewrite to work exactly how you want it too function genItem1ListJS($id) { $i = 0; $rtnstr = ""; $rtnstr .= "<script type=\"text/javascript\">\r\tvar list=new Array(); \r"; if (is_numeric($id)) //check $id is numeric { $result = DbConnector::query("SELECT * FROM listitems WHERE `listid` = $id ORDER BY `order` ASC;"); while ($row = DbConnector::fetchArray($result) ) //list list data { $rtnstr .= "\tlist[" . $i . "]=\"" . $row['item1'] . "\";\r"; $i++; } $rtnstr .= "</script>\r"; return $rtnstr; } else //$id is not numeric { $this->errors[] = "Value of \$id was not numeric in ListControl->genItem1List()"; //Value not numeric! Add error description to list of errors return false; } } it turns out something like this : <script type="text/javascript"> var list=new Array(); list[0]="Monday"; list[1]="Tuesday"; list[2]="Wednesday"; list[3]="Thursday"; list[4]="Friday"; list[5]="Saturday"; list[6]="Sunday"; </script> -
i only used one text file.....
-
my host offers masking, is it not in the server controls anywhere?
-
hey man, quit posting my social security number and bank pins will ya
-
and the moral of the story is never wash your clothes, unless dreamwest has spaffed on them
-
Can you recommend a good place to do PHP exercises?
spiderwell replied to KyZu's topic in Miscellaneous
this is how i exercise my php too. solving problems i might not ever come across in my sites that other peeps might do in theirs. i almost always learn as much myself as the person i helped. -
great thread. i'm a home grown coder, and have no certs or college courses to state to employers. but have done the odd freelance site for family /friends . you don't always have to have letters after your name, just prove to the employer your ability in the role they are offering. frankly if you have gotten to interview its more a chance to see if they like you as a person and the skills bit should been covered by your cv/resume got a job as a oop php developer on wednesday. very pleased too! yay lets all go to work doing what we love