Jump to content

ldb358

Members
  • Posts

    199
  • Joined

  • Last visited

    Never

Everything posted by ldb358

  1. ive gotten it down to this to search and replace through the document: foreach($this->filter as $name => $value){ $this->output = preg_replace('/{$name.*?([0-19]).*?}/', $value, $this->template); } but it doesn't actually replace any thing Ive never worked with regex so i dont exactly know what I'm doing but any help would be nice
  2. it works perfectly now that i took a second look but how would i do it if i say had like {test(1)} but also had {hello(1)} and i didn't want hello switched(at least with that function) thanks for the help
  3. okay what im doing is a template parsing system where it reads the file and would replace {test} with content but lets say i have a place where it lists out 20 videos i want to be able to put {test(1)} and it would be replaced with the first video(which would be stored in an array) and {test(2)} to be replaced with the second video and so on
  4. i've been looking for a way to do this but cant seem to find anything: what i want to do is say i have {test} i want to be able to replace it with 'hello' but if i have {test(1)} i want to replace test with the first value in an array(i already have a function that reads and replaces all of {test} but i cant get the array/number part of it to work).
  5. you could also use: $url = 'http://www.somesite.com/read.php?1,2,2,4,5'; $url = explode( ',' , $url); $final = $url['0'] . $url['1']; echo $final;
  6. okay that makes sense not how could i put content in those theme pages
  7. i am making a custom cms but i am stuck with the concept behind having custom themes (thus while i posted here) what i am wondering is how can i place my content with-in a theme file while still giving people the ability to write there own themes with no restrictions
  8. it gets the remainder of a division for example: 5%2=1 4%2=0 10%8=2
  9. try: mysql_query("SELECT * FROM post ORDER BY date DESC")
  10. why is it that you use and "or die" stament then check if its true? this seems slightly counter prductive as you check it twice try adding: or trigger_error("error:" . mysql_error(), E_USER_ERROR to your first mysql statment
  11. did you change the value of 'insert admin persons login here' to an actual username?
  12. Ive never worked with jquery but if your sending that exact string(or same format) that could all be handled server side for example: $test = explode('&', $_POST['your_post_value']); then just use the explode(divider,string) to keep separating till its in the format you want
  13. okay lets start: 1) it looks pretty good and i liked the feel 2)the text in the links are slightly difficult to read not a big issue for me but might be for someone else 3)the red square in the bottom left is unnecessary and take away from the site And lastly the load time was kind of slow and would be impossible on dial up all together it looks nice, the purpose is clear and the feel is good with just a couple minor issues
  14. okay you document is formated all wrong: a)that should all be in the head tag which should be in the html tag b) your nested all wrong, and not all your tags have a closing tag this means you Code is invalid c) your head cannot be in your body it has to be before d)you have a second doctype declaration which you cant do e)you have a second title your only aloud one of those per a document you cant have 2 body tags eather the </ul> must go before body and html or i can guaranty its nested that may not solve your problem but it just might that code is pretty messed up
  15. can you please post the entire unaltered script so that i can see it
  16. can you show me the whole form or page
  17. i don't get what you are asking can you clarify Edit: do you want to do somthing like this?: while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $finish[$i] = $row[2]; $centre_name[$i] = $row[1]; $i++; } switch(mysql_num_rows($results)){ case "4": echo 'your nearest 4 centre are '.$centre_name['0']."(".$finish['0'].")" . ", " .$centre_name['2']."(".$finish['1'].")" . ", " .$centre_name['2']."(".$finish['2'].")" . ", and " .$centre_name['3']."(".$finish['3'].")"; break; case "3": echo 'your nearest 3 centre are '.$centre_name['0'] ."(".$finish['0'].")" . ", " .$centre_name['1'] . "(".$finish['1'].")" . ", and " .$centre_name['2']."(".$finish['2'].")" ; break; case "2": echo 'your nearest 2 centre are '.$centre_name['0']. "(".$finish['0'].")" . ", and " .$centre_name['1']."(".$finish['1'].")"; break; case "1": echo 'your nearest centre is '.$centre_name['0']."(".$finish['0'].")"; break; case "0": echo "no records found"; break; case "5": default: echo 'your nearest 5 centre are '.$centre_name['0'] . "(".$finish['0'].")" . ", " .$centre_name['1'] . "(".$finish['1'].")" . ", " .$centre_name['2'] . "(".$finish['2'].")" . ", " .$centre_name['3'] . "(".$finish['3'].")" . ", and " .$centre_name['4']."(".$finish['4'].")" . ; }
  18. okay this should fix the results if there is only 1(or less than 5): while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $finish[$i] = $row[2]; $centre_name[$i] = $row[1]; $i++; } switch(mysql_num_rows($results)){ case "4": echo 'your nearest 4 centre are '.$centre_name['0'] . ", " .$centre_name['1'] . ", " .$centre_name['2'] . ", and " .$centre_name['3'] ; break; case "3": echo 'your nearest 3 centre are '.$centre_name['0'] . ", " .$centre_name['1'] . ", and " .$centre_name['2']; break; case "2": echo 'your nearest 2 centre are '.$centre_name['0'] . ", and " .$centre_name['1']; break; case "1": echo 'your nearest centre is '.$centre_name['0']; break; case "0": echo "no records found"; break; case "5": default: echo 'your nearest 5 centre are '.$centre_name['0'] . ", " .$centre_name['1'] . ", " .$centre_name['2'] . ", " .$centre_name['3'] . ", and " .$centre_name['4']; }
  19. try this with you first while loop: $i=0; while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $finish[$i] = $row[2]; $centre_name[$i] = $row[1]; $i++; } echo 'your nearest 5 centre are '.$centre_name['0'] . ", " .$centre_name['1'] . ", " .$centre_name['2'] . ", " .$centre_name['3'] . ", " .$centre_name['4'];
  20. all i want to do is use array_walk within my class heres what i have but it returns an undefined function: array_walk($values, '$this->prep'); array_walk($columns, '$this->prep'); also tried with the same return: array_walk($values, 'prep'); array_walk($columns, 'prep');
  21. why do you assume there is some thing wrong? what error are you getting? edit: wow i missed that
  22. try this: <?php include("includes/nSiteSQL.php"); include("admin/common/print_array.php"); function getHeadlines() { $newsheadlines = array(); $db = new nSQL(); $q = "SELECT ID, date_format(nDate, '%m.%d.%Y') as nDateF, nTitle, nDate FROM `gtt_news` ORDER BY `nDate` DESC LIMIT 5;"; $db->select($q); while($data = $db->get_row(MYSQL_NUM)) { $key = $data[3] . "news"; $newsheadlines[$key] = $data; $newsheadlines[$key][4] = "news"; } $new = array_merge($newsheadlines); krsort($new); $count = 0; foreach($new as $key => $val) { if($count<3) { $type = $val[3]; if($type == 'blog') { $link = "blogarchive.php?blogID=".$val[0]; } else { $link = "newsarchive.php?newsID=".$val[0]; } $numberofcharaters = 50; if(strlen($val[2]) > $numberofcharaters){ list($body, $extra) = str_split($val[2], $numberofcharaters); $body = $body . "..."; }else{ $body = $val['2']; } echo "<div class=\"newsitem\">"; echo "<p class=\"date\">".$val[1]."</p>"; echo "<p class=\"text\">$body</p>"; echo "<p class=\"text\"><a href=\"$link\">read more</a></p>"; echo "</div>"; $count++; } } } ?>
×
×
  • 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.