Need This

Started on the old forum in March 2010 · view the original in the archive · old links redirect here

17 replies · 1,002 views · started 16 years ago · 1 min read

5 participants
bOrN2pwn Developer · 230 posts #2

Will this work

//The Query
query_posts('posts_per_page=5');

//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
 ..
endwhile; else:
 ..
endif;

//Reset Query
wp_reset_query();

BakGat

class Counter {
public:
  void Count();
  int  ReadDisplay();
private:
  int  CurrentCount;
};

External image (may be gone) External image (may be gone) External image (may be gone)

Back up my hard drive? How do I put it in reverse? http://www.hackthissite.org Profile…

bOrN2pwn Developer · 230 posts #10

omg mobideve u are an idiot look at the footer of the waplive site and then post again. i designed waplive web and a few other waplive sites. And yes ksg91 just like you said i want that. But it must be printed like its printed there .

BakGat

class Counter {
public:
  void Count();
  int  ReadDisplay();
private:
  int  CurrentCount;
};

External image (may be gone) External image (may be gone) External image (may be gone)

Back up my hard drive? How do I put it in reverse? http://www.hackthissite.org Profile…

GumSlone Administrator Principal · 1,690 posts #11

bOrN2pwn wrote: Will this work

//The Query
query_posts('posts_per_page=5');

//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post();
 ..
endwhile; else:
 ..
endif;

//Reset Query
wp_reset_query();

do you get some output from this?

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

mobidev Senior · 312 posts #13

No need to get RUDE born2pawn.... I just said it coz a while ago (last year) I was on a site that rider gave a link to me called waplive (yes a lava edit) and then I also was on a website that had only 1 page about webhosting and design also called waplive... and no I haven't looked at the footers at all so sue me lol.

ksg91 Developer · 162 posts #14

you just need to create a mysql table with fields like id, announcement and date. then just create a simple admin panel to announce something/post update. and rest retrive announcements from db and put it where ever you want.

Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

ksg91 Developer · 162 posts #16

code to create table

CREATE TABLE announcement (
`id` int(4) auto_increament,
`text` varchar(500) NOT NULL,
`date` date,
PRIMARY KEY(id)
);

then to add announcement, you can make form and post it to

<?php
$text=$_POST['text'];
$date=date("Y-m-d");
mysql_query("INSERT INTO announcement SET tex='".$text."' ,date='".$date."' ");
?>

and to show announcements

<?php
$ann=mysql_query("SELECT text,date FROM announcement ORDER BY date desc,id desc");
while($k=mysql_fetch_array($ann))
{
$text=$k[0];
$date=$k[1];
echo "<div style=\"border:2px solid #ff0000;\">";
echo "$date<br />$text";
echo "</div>";
}
?>

Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

ksg91 Developer · 162 posts #18

then put like these to show all announcement with shrot descrition assuming that read_ann.php is page for showing specific full annoucment

<?php
$ann=mysql_query("SELECT id,text,date FROM announcement ORDER BY date desc,id desc");
while($k=mysql_fetch_array($ann))
{
$id=$k[0]
$text=substr($k[1],0,50)."...";
$date=$k[2];
echo "<div style=\"border:2px solid #ff0000;\">";
echo "$date<br />$text<br /><a href=\"read_ann.php?id=$id\">Read More</a>";
echo "</div>";
}
?>

and code for read.ann.php will be like this

$id=$_GET['id'];
$k=mysql_fetch_array(mysql_query("SELECT text,date FROM announcement WHERE id=$id"));
$text=$k[0];
$date=$k[1];
echo "<div style=\"border:2px solid #ff0000;\">";
echo "$date<br />$text<br />";
echo "</div>";

Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close