Jump to content

Parhs

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by Parhs

  1. header('Location: <script language="JavaScript">window.history.go(-2)</script>'); THat is totally wrong.How tec heck would this work however. For every page the user visits make a function that stores in an array the history. like that i suppose that you have started the session. function keepHistory() { $history=$_SESSION["history"]; $history[]=$_SERVER["PHP_SELF"]; $_SESSION["history"]=$history; } call this stuff at every page that user sees. then you would just do something like that $history=$_SESSION["history"]; header("Location : $history[Elements of array -2]");
  2. Thank you for the reply.That works. But i need some further help.. I want to replace all the tags <if test=0>content</if> with nothing.That means i want to erase them. If <if test=1>content</if> then replace that with content. Your regex works fine but if there are nested tags it becomes a mess. <if test=1>pasok <if test=0>b</if> <if test=1>a</if> s</if> So the only solution i think is to replace the most inner tags first and repeat the preg_replace. But i cant find any good regex. echo preg_replace("/<if test=0>(.)*?(?!<if)(.)*?<\/if>/s","",$pap,1); this for example wouldnt work because for example <if test=0>b</if> wouldnt match because after that there is an <if test=1>a</if> any help apreciated
  3. Hello i am trying to remove a custom tag from the file but it doesnt work... example jfsajdfjsdlfdsa<if test=0>word</if>fejjkfewkfjewkfjkewjfk should remove all the <if test=0>word</if> i tried many things..This for example scr*s the output.It prints nothing... echo preg_replace("/<if test=0>(.)*<\/if>/m","","<if test=0>pahoulo</if> <if test=1>pahoulo</if>"); Please help..
  4. I see.Nice solution though.Thank you for sharing.
  5. Hello to all First of all sorry for my English. Although i have programming experience i havent used object oriented design a lot. I know what are classes inheritance etc but i amnt sure wether i do things correctly.. Where should i start? Some books i found didnt help a lot..I want to see real examples,how others program in OOP. Also i am thinking to make a project in PHP using OOP and i am unsure how to do things. For example one simple question i have.. Suppose that i have a Database class which has some methods to retrieve and send data to database.And suppose that i have a News and Users class. Suppose i have some functions News->getNews(blabla) Users->getUserInfo(blabla) ... The question is.. Should i create a database object $database=new Database(); and pass this instance of the object at the News or Users class? e.g getNews(blabla,$database) Or getNews() should create a Database instance object ? I cant find any answer on this please help!
×
×
  • 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.