Nov 8, 2009

[aef] Most Recent Topics Listing Mod - on your Web-site pages

free web hosting
Open Discussion > MODERATED AREA > Tutorials

[aef] Most Recent Topics Listing Mod - on your Web-site pages

jlhaslip
Assuming that you have an AEF Forum software installed on your Hosting Account, and that you need [or want] to display a list of the most Recent Topics to be display, say, on your Index page, then read this Tutorial.

To begin, Define the variables that you need to connect to the Database and also define the URL to the Forum in the prescribed format as follows:
CODE
<?php //start the script
//define db information here
DEFINE ('DB_USER', '  '); // required info
DEFINE ('DB_PASSWORD', '  '); // required info
DEFINE ('DB_HOST', 'localhost'); // required info. localhost works frequently
DEFINE ('DB_NAME', '  '); // required info
DEFINE ('FORUM_URL', 'http://[sub-domain.]domain.com/[aef_folder]/index.php?tid='); // required info
// the optional parts are inside square brackets ie: sub-domain and folder
// include the parts you require in your URL

Connect to the Database and select the Database for the Query, and run the Query
CODE
// Connect to the db.
// Make the connection.
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );
// Select the database.
@mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );
// Make the query. Select the last 5 topics. adjust the LIMIT quantity to suit your needs
$query = "SELECT `tid`,`topic`,`t_description` FROM `aef_topics` ORDER BY `tid` DESC LIMIT 5 ";        
$result = @mysql_query ($query); // Run the query.

The following variables are actually used for in-line CSS so that the script can be styled independently of the site CSS file. Of course, you could also remove them and use the Div ID to style the output via the CSS file, but that is another Tutorial. smile.gif
CODE
$dl_div_bg = '#bbbbbb'; // Set the div background color
$dl_bg = '#cccccc'; // Set the dl background color
$dt_bg = '#dddddd'; // Set the dt background color
$dd_bg = '#eeeeee'; // Set the dd background color

Now that you have the database open and the Query results in an array, the script needs to start its output. I have chosen to include the results inside a Div with an ID, and its own header, so that this div can be specified in your CSS file. If you do that, remove the styling variable values from the script .
CODE
// start div and dl here
echo '<div id="forum_topics"  style=" width: 220px; padding-left:15px; padding-bottom: 10px; background-color: ' . $dl_div_bg . '" ><br />
<h3 style=" margin-top: 5px; width: 200px; background-color:' . $dd_bg . '" >Latest Forum Topics</h3>
<dl id="defn_list" style="background-color:' . $dd_bg . '; width: 200px; ">' . "\n";

Use a while statement to display the results as a Definition List, with Definition Terms and Definition Data. Again, the style info is in-line, but could be external to the script if you choose to do so.
CODE
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { // loop through the results
    echo "\t" . '<dt style=" background-color: ' . $dt_bg . '"><a href="' . FORUM_URL, $row['tid'] . '">' . $row['topic'] . '</a></dt>' . "\n";
    echo "\t\t" . '<dd style=" background-color: ' . $dd_bg . '">' . $row['t_description'] . '</dd>
';
}

echo '</dl></div'; // end the dl and div here
// tidy up the db stuff
mysql_free_result ($result); // Free up the resources.    
mysql_close(); // Close the database connection.
?>

The last segment also frees the results and closes the connection to the Database as an example of good programming style.

To add this script to your site, simply paste the code (in the listed order) into your page. (or use the attached file)
Of course, you need to name the file with a php extension (or adjust the application-handler for html to get it parsed as php), but that is another Tutorial. smile.gif

p.s.: notice also, that the script uses the 'control characters' to add tabs and new-lines to the html output. (do a view source to see them in action). that makes reading the source code a lot easier to understand.

Hope you enjoyed the Tutorial. Hope you install an AEF Forum and enjoy both the Forum and this script.

 

 

 


Comment/Reply (w/o sign-up)

-Sky-
Nice Tutorial Jim! smile.gif Will come in handy. biggrin.gif

Say, are we allowed to do Tutorials for cPanel etc and for the hosting, network and community? Just like "How to edit your profiles personal picture" or "How to edit your Avatar" etc?

-Sky

Comment/Reply (w/o sign-up)

jlhaslip
QUOTE
Say, are we allowed to do Tutorials for cPanel etc and for the hosting, network and community? Just like "How to edit your profiles personal picture" or "How to edit your Avatar" etc?

I think the Tutorials for these are all completed. Check the Tutorial section under "Contribute" sub-forum. Or use the Search feature.

And thanks.

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : , aef, recent, topics, listing, mod, web, site, pages

  1. Create Dynamic Html/php Pages Using Simple Vb.net Code
    Taking your application data, and creating a webpage for others to vie (1)
  2. How To Make An Ultimate Game List.
    If you're making a site on video games or such. (0)
    Hello. I am BuBBaG. You can call me Bubba for short. I'm going to show you how to make an
    Ultimate Game List. First off, we need to make a database, we are going to call this database
    `my_db`, leave out the `'s. Inside that database we will need to create a table called
    `ugl'(Ultimate Game List, duh). To make the table, simply enter this in the Syntax. CODE
    CREATE TABLE ugl ( System char(50), Game char(50), ) In the above code, it is stating we are
    creating a table called ugl, with two columns, System, and Game. Next, we will need to make a form,
    t....
  3. Simple Javascript And Password System
    How to protect your pages with password (10)
    The quickest way to get a password protection system up and running is to use a Prompt box in
    JavaScript that has a title like "Enter your Email Address". Only you and the relevant users know
    what the password should be, could even be one each, that can be sorted out at the next page then
    pass the "input" directly through the url by changing the .href, like
    http://www.iSource.net.nz/users/?leTmeIn= The page that then processes this should also check for
    the referring page, and three fails from an IP if you like the php (the next page): CODE //
    processdownloads.p....
  4. Php--> Content-only Pages
    Create easy to edit php pages. (9)
    Description Learn to create easy to edit content-only pages with php. By parsing your layout into
    your pages, you can reduce file sizes and files will become much neater. Try it out Ok, lets
    start by creating a file called template.php. CODE //---------------------------------
    //Layout top section //--------------------------------- $top = INSERT CODE FOR TOP OF LAYOUT
    HERE. html; //--------------------------------- //Layout bottom section
    //--------------------------------- $bottom = INSERT CODE FOR BOTTOM OF LAYOUT HERE. html; ?>
    Ok simpl....
  5. Simple Stylesheet Tutorial
    Stylesheet embedded in your site. (2)
    Hi - ill show you how to make a simple style sheet that will be embedded into your site. OK make
    sure your site is set up already (like the standard tags) To start and end off a stylesheet you
    need to do the following CODE Ok lets start CODE p { font-family: "Tahoma";
    font-size: 9; color: "red"; } So when you come to put in CODE Hi! The text will
    appear red and will be in Tahoma. I will now just show you how to change the background colour of
    the text. CODE span.hilightred {background-color: "red";} span.hilightblue {backgrou....
  6. How To Set Up A Bookmarking System On Wii
    Use your favorite social bookmarking site. (0)
    This is a simple tutorial on a way to set up a bookmarking system on your Wii with greater stroage
    than the Favorites. It is more complicated than the Favorites and requires manual URL typing. Well
    let's dive on in. Items Required Nintendo Wii Internet Channel 3 Empty Favorites Internet
    Connection An account on a social bookmarking site I will be using delicious as an example.
    delicious Ok, if you do not have an account, read on. If you do have an account, go to the
    {account} section. Ok, first you need to register an account. This can be done by clicki....
  7. Create A Google Seach Result Page Embed Within Your Site Page.
    (12)
    Create a google seach result page embed within your site page. It is easier to create
    web page that embeded the google search result in it. The first step is to go to google apply an
    account for the google ad-sense. After that login to you account and choose the create ad-seach
    option. Most of time the google search box give all we have the great and powerfull seach ability.
    But, have you think every time users get seach with it. They do redirected to another page that is
    not within you site. It is easier to create web page that embeded the google sea....
  8. Php Word Filter
    Have you accidently sworn on your site? Or do you want to keep visitor (9)
    This is pretty simple but very useful if you don't want people to swear. We will be using
    str_replace for this. CODE str_replace ("curseword, "replacemet"); ?> Thats pretty simple,
    just fill in the curse word and the replacement, and then repeat... heres what it would look like
    full size: CODE str_replace("swear", "replacement"); str_replace("swear", "replacement");
    str_replace("swear", "replacement"); str_replace("swear", "replacement"); ?> Ok, but how do you
    get it to work on your page now? Well, save that file as wordfilter.php and use CODE ....
  9. Faux Ajax Loading - Css Only
    Pretend your site is Ajax based (3)
    Link: http://www.jlhaslip.trap17.com/samples/misc/ajax/index.html Check that out. The first page
    has information and the second and has the actual example of its use with sample CSS code. I find
    that when you visit a site which has a slow server and attempt to view 'large' Image files,
    it is pretty boring to sit and stare at a blank screen, so this little snippet of code can be used
    to give the visitor something to see to indicate that the image is being downloaded. I built a
    small animated gif that sits in the background of the space allocated for the image....
  10. Do You Want To Use Php Code In Your Html Pages?
    Within two minutes you will! (9)
    Whilst searching around for help to setup cutenews blog I came across a way to use php in html pages
    - lo and behold it works! so I thought I'd share it with you all (Unfortunately I can't
    remember the site so I wrote this up a couple of minutes after I did it:) ). This method requires a
    web server with apache installed. So, luckily for us all this covers the whole of Trap17... even
    Qupis /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> Just
    to make the point, this is in no way a difficult task and it doesn't require yo....
  11. Making The Popular Id Browsing For Your Site.
    (17)
    Was just sitting and being bored but then I realized I could show how to create more or less popular
    ?id=page browsing. It's actually really easy. I know two ways how to do it. First one I learned
    was checking the variable and if it's true including the text/file/anything needed and so on. It
    was ok, but sometimes I just couldn't make it work so I switched to switch() function and
    that's what I'm going to show you guys right now. So, I made a test page which contains the
    code needed and here is its source. CODE Untitled Home - P....
  12. Document Type Declarations
    And why we use them in html pages (0)
    This code: CODE    HTML 4.0 Strict document                ... Your HTML
    content here ...      ... More HTML content here ...    represents a minimum, acceptable
    web-page according to the W3C which is the organisation that sets the standards for the World Wide
    Web, or as we call it, the Internet. In another Tutorial, you can learn about the html code, but in
    this Tutorial, I wish to emphasis the importance of the DTD or Document Type Declaration, the first
    line in the sample code above. What it does is tells the Browser that a certain set....
  13. Cpanel Useful Site Management Tools 2.1
    Part 3 of My 7 Part Tutorial (0)
    This Tutorial will be divided into 7 different parts, and this is the first part, when i get the
    other parts together, i will post the links under here /biggrin.gif" style="vertical-align:middle"
    emoid=":D" border="0" alt="biggrin.gif" /> Enjoy. Part 1: E-mail Management Part 2: Useful Site
    Management Tools Part 4: Analysis/Log Files Part 5: Advanced Tools Part 6: PreInstalled
    Scripts, Extras, and Cpanel Options Part 7: Fantastico Detailed Cpanel Tutorial Part 2.1:
    Useful Site Management Tools In this tutorial I will, in detail explain all of th....
  14. Cpanel Useful Site Management Tools
    Part 2 of My 7 Part Tutorial (0)
    This Tutorial will be divided into 7 different parts, and this is the first part, when i get the
    other parts together, i will post the links under here /biggrin.gif" style="vertical-align:middle"
    emoid=":D" border="0" alt="biggrin.gif" /> Enjoy. Part 1: E-mail Management Part 3: Useful Site
    Management Tools2.1 Part 4: Analysis/Log Files Part 5: Advanced Tools Part 6: PreInstalled
    Scripts, Extras, and Cpanel Options Part 7: Fantastico Detailed Cpanel Tutorial Part 2:
    Useful Site Management Tools In this tutorial I will, in detail explain all of t....
  15. Making A Dynamic Page On Blogspot
    Using an external server to make your pages hosted on blogspot dynamic (5)
    Good morning everyone. Have you ever wondered how to allow your visitors to edit content on your
    blog? Like adding a post straight off the page, adding a link, editing your profile etc. This will
    be extremely useful if you want your visitors to contribute to your blog besides writing comments or
    tagging. 1. Adding a post straight off the page. Go to blogger.com, login, select your blog. Go to
    settings -> email. By enabling blog email, you can now add a post by simply sending an email to the
    address you specified. The address should look something like: yourusername....
  16. Templating System Using Php Includes
    Building a Dynamic site using Includes and flat-files. (13)
    Php based Templating System http://jlhaslip.trap17.com/template/index.php The Source Code
    for the scripts are included (literally) on the different pages on the Demo, including the Contact /
    Email script. The only page not there yet is the Message Script. Maybe tonight I will upload that.
    This one uses a little bit of query-string checking to confirm that the contents of the page are
    actually available (file_exists())and an allowed page content before serving it up. The
    'allowed page content' is done by checking against a flat-file containing an array....
  17. Php Menu Bulding Script And Site Template
    available for download (0)
    A Php Menu-builder Tutorial This Sidebar Menu-builder code and the php scripts are adapted from
    a Tutorial on the Astahost.com Forum titled : CMS101 - Content Management System Design .
    Since the original tutorial's author (vujsa) did such a marvellous job of describing the system
    in the original Topic posting, I will not attempt to explain it here, rather, I invite you to have a
    look at his Topic and learn from it. The Basic tutorial provided coding for developing a table-based
    web-site template which used php includes and embedded data to create a &....
  18. Php Spy Code
    Spy on your site! (21)
    Code Spy Code Description Anyone who comes to ur forum's IP Adress, Site they came From,
    Their Browser and the time they came will get saved in a place that only the admin knows the
    location of... V.2 More features coming up in V.2!!! POst suggestions/problems... Preview:-
    http://s15.invisionfree.com/Spy/index.php ? REFRESH THE PAGE, AND GO HERE:-
    http://h1.ripway.com/programming/spy%20code/spy.html ^^^^^^^That shows all the IP's, Browsers,
    Time, site and stuff....^^^^^^^^ Code First of all, you'll need to host the files.... I
    suggest you make....
  19. How To: Make A Simple Php Site
    Making one file show up on all pages using php (21)
    I have looked all over the site and could not find anything that was like this simple, or just like
    this at all.. For some people i know that you are using a basic HTML site...and having a big menu
    if you want to add somthing you have to go into every one of the pages and add or remove or edit
    what you want to do, but with somthing verry simple all you would have to do is edit one file, and
    all of the pages that have the PHP script on them would suddenly change to what that one file is.
    So to start off if you are planning on using this little tirck, the page that you a....
  20. Not To Be Banned By Google
    Take care that your site is not banned (2)
    /sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /> Strategic search engine
    optimization involves far more than keyword research, META tags and content. If you want to mange an
    SEO program, you need to be aware of any issue that can affect your success. Domain name management
    is one of the big factors. Effective domain name management is critical because you could end up
    getting banned from Google and other search engines if you take the wrong approach. Why would
    Google ban you? In the spirit of fair play and providing depth in its results, Google ....
  21. Phpbb Forum Site Transfer
    How to do it, step by step instructions (20)
    I'm sure many of you out there have used phpBB at some point. To those who enjoy running forums
    and online communities, specifically supporting phpBB, I am about to tell everyone how to restore
    the forums database from one website, to another. This is presuming you do not have any mods or
    hacks installed. Some of you may find this information useful. Here is the scenario: Let's say
    you have forums running phpBB version 2.0.17 (currently the latest one). You have decided that you
    want to move your forums to a whole new URL and provider, and as an added bonus, ch....
  22. Css And Javascript Combined For Dynamic Layout
    use of different CSS files at same site (9)
    This tutorial is meant for people that are dealing with problems while coding their site at 100% of
    width. Important notice: Some people has JavaScript disabled, so they will not be able to load CSS
    file (take this in account when creating your website). How this script works. In the HEAD of your
    HTML document will apply this command, so variable.js file will be load at start: CODE
    In browser JavaScript file variable.js is loaded. This Javascript file consist of this parameters,
    copy this code and name it variable.js CODE // JavaScript Document if (sc....
  23. How To Make A Very Simple Wap Site
    A quick tutorial about WML language (43)
    WAP Site Tutorial : How to Make A Wap site? Before We begin.. Defination from the
    Web about Wap. QUOTE WAP is an open international standard for applications that use
    wireless communication . Its principal application is to enable access to the Internet from a
    mobile phone or PDA .A WAP browser provides all of the basic services of a computer based web
    browser but simplified to operate within the restrictions of a mobile phone. WAP is now the
    protocol used for the majority of the world's mobile internet sites, known as WAP sites ....
  24. Custom 404 Error Pages
    A Tutorial On How To Make Custom 404 Error Pages (18)
    I've seen a tutorial on here and no offense but it was horrific, this is the real way you do a
    404 Error Page. Make a file called: htaccess.txt Open it up and put this: CODE ErrorDocument
    404 /myerrorpage.html You will need to change myerrorpage.html to whatever your page is called.
    Also when you upload this file to your server you need to rename it to: .htaccess Yes, the dot is
    before the words. You need to do this on the server because on Windows you cannot do that!....
  25. Checking The Web Site Speed
    (10)
    Did you taking too much time to access your favorite sites? Probably the problem is on the server
    used by those sites. To make sure that is the problem, use Windows PING facility. Ping is a small
    program, which sends a 32-bit signal to the Web site server. Next, Ping record the time needed by
    the server to answer it. To activate Ping: Click on the Start-Run menus, type command, and then
    click OK. Type PING "site name" in the MS-DOS prompt window, for example PING www.yahoo.com. In a
    moment, the result will appear on the screen. A result less than 300ms is normal spee....
  26. How To Put A Phpbb Login Box On Your Main Site.
    Code and .php included!!! (19)
    I have included my coded file with this... Ok here is the code. CODE // //Create login area,
    replace the phpBB2 in /phpBB2/login.php with your forum's //directory //   Prank Place
    Forum Index     Please enter your username and password to log in.        
                  Username:                   Password:      
                Log me on automatically each visit:                    
    I forgot my password         You can test this out on my....
  27. Test Your Php Pages W/o Upload/internet
    complete *working* guide on how to test your php pages (64)
    In this tutorial, I'm going to show you how to test your PHP pages without the Internet or
    uploading the files to your trap17 server. This tutorial is similar to doom's, but the links he
    provided does not work, so I decided to make my own tutorial with working links. The program that I
    will be using for this tutorial is called XAMPP . XAMPP is a modification of the popular Apache
    server, and I'm using XAMPP because of its simplicity to install as well as maintain. The
    current version of XAMPP is 1.4.13 and it has the following bundled in the download: QUOT....
  28. HTML tags and examples
    Condensed form of course from my site... (37)
    Well, I decided to try and help out some of the users here who might be unexperienced in HTML, so I
    condensed the begginer's HTML course at my website. Here it is... Lesson 1 HTML means Hyper
    Text Markup Language. HTML is a very common language used for many websites, is the base for more
    complicated and powerful langauges like php, HTML can seem hard, but you will find it is one of the
    easiest langauges one can learn. The core of HTML is the tag, a tage is just a set of two
    arrows-like brackets created by hitting Shift and the comma key, or Shift and the period....
  29. Php Quiz Script
    Make quizzes for your site. (29)
    Hello all, A little bit back I decided to make a quiz scriptjust out of no where lol. However it
    doesnt do anything special but I am going to make an email mod for it so that it will email results
    to your email address. So here is the basis of it. INSTRUCTIONS: Open a new page in your text
    editor and paste in the following code. CODE $qid = "Quiz ID-00"; ?>
    Username: 1.) Question number one is? Answer1 Answer2 2.) Question number two is?
    Answer1 Answer2 3.) Question number three is? Answer1 Answer2 4.) Question num....
  30. Php Emailer/contact System
    An email or contact system for your site (20)
    Hello all, Here is an easy Emailer or Contact system that allows visitors or members of your site
    to email you just by filling out a form. So here is what you need to do to set it up. First open up
    a new page in your text editor and paste in the following code. CODE $Name = $_POST ; $Subject
    = $_POST ; $Email = $_POST ; $Site = $_POST ; $Message=$_POST ; $align = $_POST ; $to = "$EmailTo";
    $subject = "$Subject"; $body = "$Message\n\n\n$Site\nBy: $Name"; $headers = "From: $Email\n";
    mail($to,$subject,$body,$headers); // After they've clicked "Send", this is whe....

    1. Looking for , aef, recent, topics, listing, mod, web, site, pages
Similar
Create Dynamic Html/php Pages Using Simple Vb.net Code - Taking your application data, and creating a webpage for others to vie
How To Make An Ultimate Game List. - If you're making a site on video games or such.
Simple Javascript And Password System - How to protect your pages with password
Php--> Content-only Pages - Create easy to edit php pages.
Simple Stylesheet Tutorial - Stylesheet embedded in your site.
How To Set Up A Bookmarking System On Wii - Use your favorite social bookmarking site.
Create A Google Seach Result Page Embed Within Your Site Page.
Php Word Filter - Have you accidently sworn on your site? Or do you want to keep visitor
Faux Ajax Loading - Css Only - Pretend your site is Ajax based
Do You Want To Use Php Code In Your Html Pages? - Within two minutes you will!
Making The Popular Id Browsing For Your Site.
Document Type Declarations - And why we use them in html pages
Cpanel Useful Site Management Tools 2.1 - Part 3 of My 7 Part Tutorial
Cpanel Useful Site Management Tools - Part 2 of My 7 Part Tutorial
Making A Dynamic Page On Blogspot - Using an external server to make your pages hosted on blogspot dynamic
Templating System Using Php Includes - Building a Dynamic site using Includes and flat-files.
Php Menu Bulding Script And Site Template - available for download
Php Spy Code - Spy on your site!
How To: Make A Simple Php Site - Making one file show up on all pages using php
Not To Be Banned By Google - Take care that your site is not banned
Phpbb Forum Site Transfer - How to do it, step by step instructions
Css And Javascript Combined For Dynamic Layout - use of different CSS files at same site
How To Make A Very Simple Wap Site - A quick tutorial about WML language
Custom 404 Error Pages - A Tutorial On How To Make Custom 404 Error Pages
Checking The Web Site Speed
How To Put A Phpbb Login Box On Your Main Site. - Code and .php included!!!
Test Your Php Pages W/o Upload/internet - complete *working* guide on how to test your php pages
HTML tags and examples - Condensed form of course from my site...
Php Quiz Script - Make quizzes for your site.
Php Emailer/contact System - An email or contact system for your site

Searching Video's for , aef, recent, topics, listing, mod, web, site, pages
See Also,
advertisement


[aef] Most Recent Topics Listing Mod - on your Web-site pages

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com