Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About DarkElf

  • Rank
  1. Nope, already tried that The str_replace function doesn't seem to like patterns which run across multiple lines. I can't understand why, the \n character seems to have some special rules applied to it that make it behave funny.
  2. I'm trying to write a code that takes a txt file and converts it to html whilst retaining formatting. It all works fine except for one little glitch - where there is a double return in the txt file I want to close the html paragraph element and then open a new one (so the paragraph is properly split using the <p></p> tags rather than double <br />'s). For some reason I can't get it to work properly.I've used nl2br() to convert new lines to breaks (<br />). I've then tried using str_replace() to search for instances where there are two <br /> tags immediately after
  3. Forgive me if I'm wrong, but that looks like they are just shifting the contents of a paragraph not included in the div up the page using position relative so that it appears to be inside the div?It's a nice idea but doesn't quite work for my problem as my div is not of a fixed size.
  4. I've been having a lot of fun with this opacity stuff, however I've just noticed a problem on my pages and can't work out how to fix it.Basically I've got a div which contains text and images which has opacity of 75% so that the background image is partially visible through the div. But it turns out that not only is the div itself transparent, but all of its contents are as well. This is barely noticable with black text, in fact until now I hadn't spotted it at all, but once I started adding images its quite obvious and isn't the desired effect. What I want to do is make the background colour
  5. It's possible to rewrite the php files everytime you update the variables, you just need to set the correct access permissions on the files.But you are creating hurdles you don't need to! What you are effectively talking about is flat files, these used to be all the rage before relational databases. The reason relational databases are now used so commonly is because they are much better at the job.If you really want to use a flat file system I would go back to your xml files. Just place them in a folder without public access, that way a public request for them will be denied but your php scrip
  6. There are loads of things you can use to make a game, for your text based style game I would suggest the following:1. A good working knowledge of html/xhtml, css, and javascript (you are making a website after all).2. A good working knowledge on xml - I'm a bit of a hypocrit here as I've never used it much, but it goes with the above point.3. An extremely good knowledge of a server side script such as PHP or ASP, or possibly another more powerful scripting language that can be integrated with the web.4. An extremely good knowledge of a database system, MySQL is a good one for beginners.5. If y
  7. Always check for other threads on your topic before posting, you will often find the answers you are looking for http://w3schools.invisionzone.com/index.php?showtopic=5409
  8. DarkElf

    Blank Field Check

    This is normally something you'd do with javascript before the form has been posted, but if you want to do it with php then you could use a simple if statement to test each field. The best way to do it would be an if with an is not (=!) clause to which will return true if the value isn't empty. Something like: if($_POST('fieldname') =! ''){code to be executed} This can be followed by an else clause if you want it to do something special if the field is empty.
  9. Which assumes you have that kind of control over your server (if you are renting webspace that is quite unlikely!)
  10. What do you mean by tools? as SFB says, php itself can be downloaded from php.net if that is what you mean.If you mean the tools for writing and working with php then you just need a simple text editor such as notepad, nothing more complicated is required.If you want to test php scripts on your pc then you also need to install a server and php, this can be done the easily by using a prebuilt package such as xampp.
  11. Without wanting to dampen your enthusiasm (which is great).... The coding you need for those kind of games can get pretty complicated (I'm talking thousands and thousands of lines of code). As with a lot of things in life, you can't just dive straight in at the deep end, you need to start somewhere simple and learn the building blocks step by step.Build lots of websites and learn to use PHP to perform simple tasks for these sites. Once you're comfortable with that you can start using it for more complex things and eventually you will gain the knowledge and experience to build your game. You wi
  12. Not sure where the slashes come in, but I think you can do it using query strings.The query string variable is added to the url: www.mywebsite.com/index.php?page1To retrieve the variable use this: $variable = $_SERVER['QUERY_STRING']; The you can then use variable in your code, this could for example be the name of a file that contains the content to be displayed on the page, therefore you can use your index.php file as a template and import the content using something like this: $content = file_get_contents($variable.'txt');echo '<p>'.$content.'</p>';
  13. You need to store the titles in an array, and then have a subarray under each title storing the subtitles. You can then use nested foreach loops to work through the main array and then each subarray to list the contents.
  14. Ok, I don't approve of just giving people the answer, on top of which I've not got time to try it all out and test it, but here are a few things you could try playing with.The first thing that leaps out is that you've got all those pictures floating left, floats can commonly cause problems in which things spill out of divs (exactly what you are seeing now). You have to have the float there so try and see if you can find another way to ensure the div stays the right size other than purely expecting it to resize to fit the content. If you are only ever going to use the same number a size of imag
  • Create New...