Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // posts.php
- $idCounter = 0;
- $posts = array();
- $posts[ $idCounter++ ] = array( 'title' => 'Some Post', 'content' => '...' );
- $posts[ $idCounter++ ] = array( 'title' => 'Another Post', 'content' => '.....' );
- // ...
- // postListing.php
- require_once( 'posts.php' );
- foreach ( $posts as $id -> $post )
- {
- echo( '<h1><a href="post.php?id=' . $id . '">' . $post[ 'title' ] . '</a></h1>' );
- }
- // viewPost.php
- if ( !isset( $posts[ $_GET[ 'id' ] ] ) die( "No such post" );
- $post = $posts[ $_GET[ 'id' ] ];
- echo( '<h1>' . $post[ 'title' ] . '</h1>' );
- echo( $post[ 'title' ] );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement