• I’ve deleted two Link catagories and now I’ve got catagory numbers: 1, 4, 5, 6. Is there anyway to “fix” it so that I can have a “2” and a “3” again? (I’ll know to rename them next time.) 😉
    Thanks,
    John

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hi John,
    There isn’t really other than directly manipulating the database.
    You can, however, use get_linksbyname() and pass the name of your category as the first parameter.
    That way you don’t need to use (or care about) the numbers.
    Mike

    Thread Starter john

    (@john)

    Thanks Mike,
    Normally, I’m an idiot with mySql, but I went in and found out how to change them back to consecutive numbers–and I’ll remember to edit the names this time and not delete them. 🙂
    For those who have phpmyadmin:
    1. goto “b2linkcatagories” (or whatever you have it named)
    2. check mark “cat_name” and click the “Browse” tab
    3. your catagories show up in a table, just click the “Edit” button and edit the “cat_id”
    4. It’s been two minutes since I’ve made these changes, and so far nothing has crashed! 🙂
    John

    John,
    A word of caution, if you already had links assigned to those categories, you will need to change those links to refer to the new category id’s
    Mike

    Thread Starter john

    (@john)

    I think they reverted back to “general” .. although now I’m worried–but no problems so far. 🙂

    Thanks for the tip!, now if I can figure out how to reset the “Next Autoindex” to reflect the next inserted link-catagory instead of the total. ie change the 6 to 4

    Thread Starter john

    (@john)

    well… I did run into a little glitch .. although I was able to renumber my categories, the next new one I created was two numbers off. So now I have 1-5, 7.

    John,
    Such is the nature of MySQLs auto-numbering feature.
    As I mentioned before it’s not really important what the unique numbers are.
    You can either use get_linksbyname() (barring non-ascii chars in your categoriy name) or just reference the id anyway in get_links().
    Mike

    Thanks Mike…
    The links by name works fine. I also wanted to pass this info along for others. It’s probably documented some place, but I couldn’t find it:
    <?php get_links(-1, ‘<i>’,’

    ‘, ”, 0, ‘_updated’, 0, 0, -1, -1) ?>
    From left to right:
    1. -1=which category to display (-1=all, 2 would be for category 2… I called a category that I didn’t have links for and got an error message–I’m ok with that. :))
    2. ‘<i>’,’

    ‘, (any formatting…non-numeric characters have to be in single quotes)
    3. ”= empty spot? I don’t know what this is for.
    4. 1= display image for link (if you supplied one) 0=don’t display images for links.
    5. ‘_updated’ who knows
    6. 0=title
    7. 0=stars
    8. -1=number of links to display (-1 displays all, 4 would display four out of all links for this category)
    9. -1=who knows?

    Hi John,
    They are documented in the file links.php at the top of each function:
    /** function get_linksbyname()
    ** Gets the links associated with category ‘cat_name’.
    ** Parameters:
    ** cat_name (default ‘noname’) – The category name to use. If no
    ** match is found uses all
    ** before (default ”) – the html to output before the link
    ** after (default ‘
    ‘) – the html to output after the link
    ** between (default ‘ ‘) – the html to output between the link/image
    ** and it’s description. Not used if no image or show_images == true
    ** show_images (default true) – whether to show images (if defined).
    ** orderby (default ‘id’) – the order to output the links. E.g. ‘id’, ‘name’,
    ** ‘url’, ‘description’ or ‘rating’. Or maybe owner. If you start the
    ** name with an underscore the order will be reversed.
    ** You can also specify ‘rand’ as the order which will return links in a
    ** random order.
    ** show_description (default true) – whether to show the description if
    ** show_images=false/not defined
    ** show_rating (default false) – show rating stars/chars
    ** limit (default -1) – Limit to X entries. If not specified, all entries
    ** are shown.
    ** show_updated (default 0) – whether to show last updated timestamp
    */
    Mike

    Mike wrote:
    Such is the nature of MySQLs auto-numbering feature.
    So is there no way to change the “next autoindex” number thorugh phpmyadmin?
    /Lars

    There seems to be a way with the myisamchk command line tool.
    From the MySQL manual:
    Other Options for myisamchk'
    -A or –set-auto-increment[=value]’
    Force auto_increment to start at this or higher value. If no value
    is given, then sets the next auto_increment value to the highest
    used value for the auto key + 1.
    I’m not sure whether you can get at this functionality from phpMyAdmin
    Mike

    in the phpmyadmin click on a structure for the table you want to change next autoincrement and then click on OPERATIONS, on the bottom you can change next autoincrement.

    if you use earlier version of PHP, that feature is not available. Still in all versions You can run sql query for example

    ALTER TABLE tbl_mytable AUTO_INCREMENT =4

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Link Manager – Link Catagories’ is closed to new replies.