SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 38 of 38
  1. #26
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thx edshuk,

    I think s001dxp has sorted the problem out just wainting for him to send the files back.

    Thx Again
    Deano

  2. #27
    SitePoint Member
    Join Date
    Jul 2003
    Location
    Birth Place of Aviation
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I need you email address to email you the zip

    Port

  3. #28
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question..

    I know alot of the SP community have helped me a considerably alot which i'm truely grateful for and would'nt have managed this project on my own, however.. I have one more question regarding categories please dont shout

    is it possible to create a category inside a category :

    example..

    music +
    Albums +
    - wet wet wet
    - take that
    - queen
    - carpenters

    I hope you understand my examples, If it is possible could you please post any how to's and may some examples..

    Thanks for your time
    Deano
    Last edited by Deano; Aug 4, 2003 at 13:51.

  4. #29
    SitePoint Member
    Join Date
    Jul 2003
    Location
    Birth Place of Aviation
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes-- it is possible.

    You want categories and sub-categories.

    By the way, how did the solution I sent you work out--you never responded.

    To add categories and sub-categories.

    Just add another table and call it Categories.
    Add another column to your existing columns table and call it categories (or something) And change the name of the table to Sub_categories (or something)

    Next, just follow the same model that we did with the first.

    Put the category id in the subcat table and the subcat id in the news table.

    Port

  5. #30
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops so sorry for not writing how things went, I got a little caught up in all the excitement. It ran perfectly Port thx for your help in this matter, I couldnt have managed it without you.

    Im currently working on a little snippet that will show all categories automatically and when clicked should display a list of of files in the particular category.

    As soon as I've managed to get this part working then i shall move on to the SUB categories..

    Thx Again for your help Port, hope you wish to help me out as i go along with the new features im writing.

    Best Reagrds
    Deano

  6. #31
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    btw.. what did you think to the script overall ? I hope you liked it

  7. #32
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Deano

    I am so glad you got the help. The last few days have been rushed.

    Cats in cats

    My menu is a category. To add another category, just add an item to the db.

    When the page is called, the menu is generated
    Do a mouseover and you will see the ?class= with the name of the item.

    Clicking one initiates the search (using a many to many) to locate all occurances of the id number and the related id number in my shop db to come up. At the same time, the second category is generated and put at the top of the center section.

    I am about to ask for help to limit the display to a single occurance of a shop rather than the multiples now obvious.

  8. #33
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HI Ed shuk.. good luck with your cats system..

    No doubt I will be posting on the categories matter again in the VERY near future..

    Cheers
    Deano

  9. #34
    SitePoint Member SadSalman's Avatar
    Join Date
    Sep 2003
    Location
    Karachi
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating Categories

    Hi,
    i have something similiar problem as Deano has..
    My table name is nuke_tutorials
    and nuke_tutorials_categories

    nuke_tutorials has: tid, cid, pagename, content, counter
    nuke_tutorials_categories has: cid, title, description

    the code i already have is:
    btw i have PhpNuke
    PHP Code:
    <?php
    require_once("mainfile.php");
    $module_name basename(dirname(__FILE__));
    if(!
    $tid$pagetitle "- Tutorials";
    elseif(
    $tid) {
           
    $sql "SELECT pagename FROM nuke_tutorials WHERE tid='$tid'";
           
    $result $db->sql_query($sql);
           
    $row $db->sql_fetchrow($result);
           
    $pagetitle "- Tutorials :: $row[pagename]";
    }
    include (
    "header.php");
    OpenTable();

    function 
    show($tid) {
    $sql "SELECT * FROM nuke_tutorials WHERE tid='$tid'";
    $result mysql_query($sql);
    while(
    $row mysql_fetch_array($result)){

    echo 
    "$row[content]<br>";


    echo 
    "<font class=gensmall><center>This Tutorial Has Been Viewed
    <b>
    $row[counter]</b> Times</center></font>";

    }
    $updatecounter "UPDATE nuke_tutorials SET counter=counter+1 where tid='$tid'";
    mysql_query($updatecounter);
    }


    function 
    index() {
    echo 
    "Welcome!";
    echo 
    "</td></tr>";
    echo 
    "<tr><td width=100% background=\"themes\SMblue\images\blue.gif\" class=orange>";
    echo 
    "Hi friends,<br>";
    echo 
    "I spent my last Week in Searching for Tutorials about how to Create Custom Modules in Php-Nuke and how to Make Them Searchable via Nukes Default Search Module..<br><br>";
    echo 
    "the help i recieved From Related sites was Null :P<br>";
    echo 
    "Now dont think that i am complaining, i know they are busy in Enhancing nuke, and they Also have their own Life,<br> so i gave them a rest and Tried to Search on Google For It..<br><br>";
    echo 
    "Quite Surprisingly i didnt find anything even related to this..<br>";
    echo 
    "But i did find Two other Cool Tutorials Which Were:<br>";
    echo 
    "<ol>";
    echo 
    "<li>How to add Data to Database</li>";
    echo 
    "<li>How to Show it on Browser</li>";
    echo 
    "</ol>";
    echo 
    "Then with some common sence and with some help of already created Php-Nuke modules i made my Own Modules :<br>";
    echo 
    "My Modules: <a href=\"Http://Thalassemia.Com.Pk/nuke/modules.php?name=Islam\" target=_blank>Islam</a> - <a href=\"Http://Thalassemia.Com.Pk/nuke/modules.php?name=Pakistan\" target=_blank>Pakistan</a> - <a href=\"Http://Thalassemia.Com.Pk/nuke/modules.php?name=thal\" target=_blank>Thalassemia</a><br><Br>";
    echo 
    "After that i also Added them in Search Module of PhpNuke<br><br>";
    echo 
    "Then i thought that i should Share the Experience with others, so that others dont have to Search whole night like me ;)<br><br>";
    echo 
    "Any wayz i hope you find them easy :)<br>";
    echo 
    "and i hope that you dont find any bugs :><br>";
    echo 
    "But if you do found any bugs please Email me at:<br>";
    echo 
    "<b>webmaster (at) thalassemia (dot) com (dot) pk</b>";
    }

    function 
    add_tut() {
    global 
    $prefix$db$sitename$admin$module_name;
    if (
    is_admin($admin)) {
    OpenTable();
    echo 
    "<form action=\"modules.php?name=$module_name\" method=POST>";
    echo 
    "<input type=\"hidden\" name=\"op\" value=\"addtut\">";
    echo 
    "Tutorial Name: <input type=\"text\" name=\"pagename\"><br>";
    echo 
    "Content: <textarea name=\"content\" style=\"width: 150px\"  rows=\"4\" cols=\"50\" class=\"post\"></textarea><br>";
    echo 
    "Counter: <input type=\"text\" name=\"counter\">";
    echo 
    "<input type=\"submit\" value=\"Submit\">";
    echo 
    "</form>";
    CloseTable();
    } else {
    OpenTable();
    echo 
    "Access Denied";
    CloseTable();
    }

    }

    function 
    addtut($tid$pagename$content$counter) {
    global 
    $prefix$db$sitename$admin$module_name;
    if (
    is_admin($admin)) {
    $sql "INSERT INTO nuke_tutorials( pagename, content, tid, counter )
    VALUES ('
    $pagename', '$content', '$tid', $counter)";

    $result mysql_query($sql);

    OpenTable();
    //Code to check if statement executed properly and display message
    if ($result) {

    echo(
    "PageName, Content, Url and Counter successully added<br>Click <a href=\"javascript:history.back(1)\">here</a> for another Tutorial");
    } else {
    echo(
    "An error has occured");
    }
    CloseTable();

    } else {
    OpenTable();
    echo 
    "Access Denied";
    CloseTable();
    }

    }

    function 
    mod_tut() {
    global 
    $prefix$db$sitename$admin$module_name;
    if (
    is_admin($admin)) {

    OpenTable();
    echo 
    "<form action=\"modules.php?name=$module_name\" method=POST>";
    echo 
    "<input type=\"hidden\" name=\"op\" value=\"modtut\">";
    echo 
    "Tutroial: <input type=\"text\" name=\"tid\"><br>";
    echo 
    "<input type=\"submit\" value=\"submit\">";
    echo 
    "</form>";
    CloseTable();

    } else {
    OpenTable();
    echo 
    "Access Denied";
    CloseTable();
    }

    }

    function 
    modtut($tid$pagename$content$counter) {
    global 
    $prefix$db$sitename$admin$module_name;
    if (
    is_admin($admin)) {
    // Select Relative Tutorial Data From Database
    $sql "SELECT * FROM nuke_tutorials where tid='$tid'";
    $result $db->sql_query($sql);

    // If there is any Result
    if ($db->sql_numrows($result) == 1) {
    $row $db->sql_fetchrow($result);}
    // Show the Results

    OpenTable();
    echo 
    "<form action=\"modules.php?name=$module_name\" method=Post>";
    echo 
    "<input type=\"hidden\" name=\"op\" value=\"modit\">";
    echo 
    "<input type=\"hidden\" name=\"tid\" value=\"$row[tid]\">";
    echo 
    "<table bgcolor=#000000 cellspacing=1 width=100% border=0><tr bgcolor=#ffffff>";
    echo 
    "<td>Tutorial Url:</td> <td><b>$row[tid]</b></td></tr>";
    echo 
    "<tr bgcolor=#ffffff><td>Tutorial Name:</td> <td><input type=\"text\" name=\"pagename\" value=\"$row[pagename]\"></td></tr>";
    echo 
    "<tr bgcolor=#ffffff><td>Content:</td> <tD><textarea name=\"content\" rows=\"10\" cols=\"80\" class=\"post\">$row[content]</textarea></td></tr>";
    echo 
    "<tr bgcolor=#ffffff><td>Counter:</td> <tD><input type=\"text\" name=\"counter\" value=\"$row[counter]\"></td></tr>";
    echo 
    "<tr bgcolor=#fcfcfc><td colspan=2 align=center><input type=\"submit\" value=\"Submit\"></td></tr></table>";
    echo 
    "</form>";
    CloseTable();

    // Close Sql Query
    } else {
    OpenTable();
    echo 
    "Access Denied";
    CloseTable();
    }

    }

    function 
    modit($tid$pagename$content$counter) {
    global 
    $prefix$db$sitename$admin$module_name;
    if (
    is_admin($admin)) {
    $sql "UPDATE nuke_tutorials SET pagename='$pagename', content='$content', counter='$counter' where tid='$tid'";

    $result mysql_query($sql);

    //Code to check if statement executed properly and display message
    if ($result) {

    OpenTable();
    echo(
    "PageName, Content, and Counter OF $tid successully modified<br>Click <a href=\"javascript:history.back(2)\">here</a> for another Tutorial");
    CloseTable();

    } else {

    OpenTable();
    echo(
    "An error has occured");
    CloseTable();

    }
    } else {
    OpenTable();
    echo 
    "Access Denied";
    CloseTable();
    }

    }

    function 
    del_tut() {
    global 
    $prefix$db$sitename$admin$module_name;
    if (
    is_admin($admin)) {

    OpenTable();
    echo 
    "<form action=\"modules.php?name=$module_name\" method=POST>";
    echo 
    "<input type=\"hidden\" name=\"op\" value=\"deltutconfirm\">";
    echo 
    "Tutorial: <input type=\"text\" name=\"tid\"><br>";
    echo 
    "<input type=\"submit\" value=\"submit\">";
    echo 
    "</form>";
    CloseTable();

    } else {
    OpenTable();
    echo 
    "Access Denied";
    CloseTable();
    }

    }

    function 
    deltutconfirm($tid) {
    global 
    $prefix$db$sitename$admin$module_name;
    if (
    is_admin($admin)) {

    OpenTable();
    echo 
    "<script language=\"JavaScript\">
    <!-- Begin
    function DontDelete() {
    window.open(\"index.php\",\"_self\");
    }
    //  End -->
    </script>"
    ;

    echo 
    "<form action=\"modules.php?name=$module_name\" method=POST>";
    echo 
    "<input type=\"hidden\" name=\"op\" value=\"deltut\">";
    echo 
    "<input type=\"hidden\" name=\"tid\" value=\"$tid\">";
    echo 
    "Are You Sure You Want To Delete This Tutorial: <b>$tid</b> ??";
    echo 
    "<input type=\"button\" value=\"No\" onClick=\"DontDelete()\"> <input type=\"submit\" value=\"Yes\">";
    echo 
    "</form>";
    CloseTable();

    } else {
    OpenTable();
    echo 
    "Access Denied";
    CloseTable();
    }

    }

    function 
    deltut($tid) {
    global 
    $prefix$db$sitename$admin$module_name;
    if (
    is_admin($admin)) {
    $sql "DELETE from nuke_tutorials where tid='$tid'";

    $result mysql_query($sql);

    //Code to check if statement executed properly and display message
    if ($result) {

    OpenTable();
    echo(
    "$tid successully Deleted");
    CloseTable();

    } else {

    OpenTable();
    echo(
    "An error has occured");
    CloseTable();

    }
    } else {
    OpenTable();
    echo 
    "Access Denied";
    CloseTable();
    }

    }

    switch(
    $op) {

        case 
    "show":
        
    show($tid$pagename$content$counter);
        break;

        case 
    "mod_tut":
        
    mod_tut();
        break;

        case 
    "modtut":
        
    modtut($tid$pagename$content$counter);
        break;

        case 
    "modit":
        
    modit($tid$pagename$content$counter);
        break;

        case 
    "add_tut":
        
    add_tut();
        break;

        case 
    "addtut":
        
    addtut($tid$pagename$content$counter);
        break;

        case 
    "del_tut":
        
    del_tut();
        break;

        case 
    "deltutconfirm":
        
    deltutconfirm($tid);
        break;

        case 
    "deltut":
        
    deltut($tid);
        break;

        default:
        
    index();
        break;

    }
    CloseTable();
    include (
    "footer.php");
    ?>
    Can anybody just tell me that where and what should i add in this so that it can show tutorials from categories.. ??

    Thanks in Advance

  10. #35
    SitePoint Member SadSalman's Avatar
    Join Date
    Sep 2003
    Location
    Karachi
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi again friends,
    i have somehow solved this puzzle.. thanks for all of you..

  11. #36
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by s001dxp
    To add categories and sub-categories.

    Just add another table and call it Categories.
    Add another column to your existing columns table and call it categories (or something) And change the name of the table to Sub_categories (or something)

    Next, just follow the same model that we did with the first.

    Put the category id in the subcat table and the subcat id in the news table.

    Port
    Sorry port I don't follow you

    Best Regards
    Deano

  12. #37
    SitePoint Member SadSalman's Avatar
    Join Date
    Sep 2003
    Location
    Karachi
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm i guess what you have to do is:
    Create News
    Create News_Categories
    Create News_SubCategories
    Tables

    in News you will give the scid (sub-catid) of the Sub Category you wish to add that news in, News title, News Content, News id, etc. etc.

    in News_SubCategories you give cid(main Cat-id) so that you can show those sub categories from browser, SC-Title, Sc-Description

    in News_Categories just give Cat-Description, Cat-Title
    i guess thats what has to be done

  13. #38
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    keeps selecting all sub categories

    for some unknown reason when i use the code below, instead of selecting a spcified subcategory it selects all categories

    I've tryed various ideas but still displays all instead of one specified sub-category

    PHP Code:
    <?php 

    include("conf.php" ); 

    $connection mysql_connect($host$user$pass) or die ("Unable to connect!" ); 

    mysql_select_db($db) or die ("Unable to select database!" ); 

    $subcats = @mysql_query('SELECT ID,name FROM subcats'); 
    if (!
    $subcats) { 
    die(
    'Error retrieving sub-categories from the database!'
    'Error: ' mysql_error() . '</p>'); 


    $query " SELECT cat.ID, cat.name, count(*) as total FROM subcats cat, kms_dloads WHERE cat.ID = cid GROUP BY cat.ID, cat.name ";  

    $kms_dloads = @mysql_query($query); 

    while (
    $cat mysql_fetch_array($kms_dloads)) 

      echo(
    '<li class="txt"><a href="././display_a_cat.php?id=' $cat['ID'] . '">' $cat['name'] . '</a> (' $cat ['total'] . ')<br>'); 


    ?>
    does anyone know the reason why this is happening

    Best Regards
    Deano


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •