Archived Comment Thread

Please visit the new AZIndex Website for all the latest on the AZIndex plugin.

I have preserved the old comment thread below in case some people are still linking here, or coming back to find answers to old questions.

For new questions, comments, and feedback about AZIndex, please use the new Feeback page.

  • #1 written by Jon Peltier
    about 2 years ago

    I set up an index, it tells me the index was successfully created, but the index page shows only

    [az-index]

    in the Edit Page screen of the WordPress dashboard, and when previewing the page, all that appears is

    ERROR: No index for this page was found.
    (Message from the AZIndex plugin)

  • #2 written by English Mike
    about 2 years ago

    Hi Jon, sorry you’re having trouble. I just double-checked to make sure the published version of the plugin works for me, and it does (phew!):

    http://englishmike.net/azindex-test-page/

    The plugin keeps track of the index page it creates from the pageid that WordPress assigns it. The error your seeing should only happen if the id of the page containing the index doesn’t match any of the index definitions you created.

    Anyway, first I would try starting over. Delete the index you created and try again. Don’t change any of the options at first except for entering a title for your index page, and see if that works. If that does works then it’s possible that the combination of the options you chose caused a bug. Let me know what you find.

    But if you’re still having a problem with any index configuration that probably means that your WordPress setup is different from mine.

    What version of WordPress are you using? And what version of PHP is your WordPress installation using? I have only tested the plugin with WP 2.5 and WP 2.5.1, both of which were using PHP 5. If your installation is using PHP 4.3 and I accidentally slipped in a 5.0 only API (I am fairly new to PHP) then that could be causing the problem.

    Mike

  • #3 written by Jon Peltier
    about 2 years ago

    Hi Mike -

    I am using WP 2.5.1, PHP 5.1.6.

    I’ve tried deleting the index page and rebuilding it, including attempting different settings and combinations. The post is created, it just doesn’t contain any information.

  • #4 written by Jon Peltier
    about 2 years ago

    Also MySQL 5.0.45.

  • #5 written by English Mike
    about 2 years ago

    Hey Jon, well this is a bit of a head-scratcher since it’s a pretty basic function that’s not working for you. If the plugin wasn’t installed correctly you would be having much worse issues, and you seem to have all the up to date software installed (assuming PHP 5.1 didn’t change anything, which I think is a safe assumption).

    I haven’t heard of anyone else having the same problem yet (there have been about 35 downloads so far, but no other feedback), but it is early days (my first day of my first foray into open source software!). So I would like to investigate further, if you are willing to bear with me (I appreciate you willingness to try out the plugin).

    I don’t have solutions tonight, but I will do some more digging tomorrow to see why the plugin can’t match the created page’s id with the index you created. The logic is very simple — I call id = wp_insert_post(…); and immediately insert the returned id into the database the very next line. If the page create failed then you would see no new page, and if the database insert failed then you would not see a new index in the table. But you see them both. Very strange.

    Unless the post’s ID has been modified in some way (you don’t happen to have any weird plugins installed that might do something like that — do you?), then I am still missing something in my code (which is perfectly possible). I do make the assumption that the id of a post is immutable once it has been created — perhaps I am wrong in that case?

    Anyway, enough rambling. I will investigate further tomorrow.

    Cheers,

    Mike

  • #6 written by English Mike
    about 2 years ago

    By the way, I forgot to say this earlier — you should only see [az-index] when you edit the index page — the index is built on the fly when a user accesses it. (or should be anyway!). You can add text in front of [az-index] or after it too (as in the example on this site). But you certainly should not be seeing that error message when you preview the page.

  • #7 written by Jon Peltier
    about 2 years ago

    Mike -

    Makes sense about seeing the [az-index] in the Edit Post screen.

    Another hint: When I create an index, I see the message saying “Index added successfully”, but it also says “No index pages found”. Even when I navigate away and return to the screen. Shouldn’t this update when the index is added?

  • #8 written by Jon Peltier
    about 2 years ago

    Installed plugins:

    Adsense-Deluxe 0.8
    Akismet 2.1.5
    AZIndex 0.1
    BackUpWordPress 0.4.5
    CommentMailer 0.1.3
    FeedBurner FeedSmith 2.3.1
    Google XML Sitemaps 3.1.0.1
    iG:Syntax Hiliter 3.5
    Post-Plugin Library 2.5.0.6
    Recent Comments 2.5.0.1
    Recent Posts 2.5.0
    Similar Posts 2.5.0
    Text Link Ads 3.1.0
    Ultimate Google Analytics 1.6.0
    WordPress.com Stats 1.2.1
    Wordpress Automatic Upgrade 1.1
    WordPress Database Backup 2.1.5
    wp-cache 2.1.2

  • #9 written by baron
    about 2 years ago

    hi. Thanks for plugin

    perfect.

    Regards

  • #10 written by Fred
    about 2 years ago

    Hi. Looks like a plug that would fit nicely on my blog. One question though, is it possible to implement the index on an existing page – ie my Arcives page? Having the index beneath the archive list would look really cool.

    Cheers from Stockholm, Sweden.

  • #11 written by English Mike
    about 2 years ago

    Hi Jon (and Fred) – thanks for the info. I was thinking about the way the plugin links indexes to posts using post-ids, and have come to the conclusion it might be a bit flaky. I am going to make a change to the way I do that — essentially by changing [az-index] to something like [az-index id=3] where the id is the id of the index you created, so the plugin no long relies on the id of a post staying the same.

    That will actually help Fred’s situation since you will be able to plug an index into any page (i.e. the Archives page) or even a post, if you wanted to. That sounds like a better solution.

    I can’t guarantee it will fix your problem, Jon, but it should. I’ll try to have a new version of the plugin available today.

    Cheers,

    Mike

  • #12 written by English Mike
    about 2 years ago

    Fred — to clarify — you can’t plug the index into another page at the moment, but the next version will allow you to do that.

  • #13 written by Jon Peltier
    about 2 years ago

    Mike – This open source stuff is neat. A little discussion, followed by a little improvement, etc. Always getting a little better, almost painlessly.

  • #14 written by English Mike
    about 2 years ago

    I agree, Jon. And thanks for persevering with me. I know from personal experience how easy it is to just drop something if you can’t get it to work first time :-)

    Anyway, I just uploaded version 0.2 of the plugin, which I am pretty sure will fix your problem. My guess is that one of your other installed plugins was doing something I hadn’t anticipated (which was my problem, not theirs), and the more I thought about it, the worse I realized my assumption was.

    Anyway, the cool thing is that as a result of fixing the problem, Fred now gets to put the index anywhere he wants, so it’s a win-win all round (until you find the next show-stopper bug, anyway!).

  • #15 written by Fred
    about 2 years ago

    Sounds great Mike! I actually giggled at the ‘next show-stopper bug’ remark, how sad or
    cool is that? Anyway – looking forward to the new feature!

  • #16 written by Cegah Satwa Punah
    about 2 years ago

    I’ve just downloaded, not tested yet.

  • #17 written by Mike F.
    about 2 years ago

    Mike,

    Very cool idea for a plugin. The plugin demo on your site looks like exactly what I need.

    Unfortunately, I’m having the same problem as Jon. When I create an index, I receive the message that the index was successfully created, but immediately below that, I still see the message “No indexes found”. It does create the blog page, with [az-index id=1], but when I publish and navigate to that page, I see the message “ERROR. No indexes found for that id”…or something close to that.

    I’m using PHP 5.2.6, MySQL 4.1.1, and Wordpress 2.5.1. I do have quite an assortment of plugins, so I might experiment with disabling some of them. Some of the plugins that Jon and I have in common are wp-cache, google xml sitemaps, and wp-stats.

    One question: does your plugin create a new table? If so, what is this table called? I don’t see a new table in my database, but I could definitely be overlooking it.

    Anyway, thanks again. I’ll do some investigating and let you know what I find.

    Thanks,
    Mike

  • #18 written by Mike F.
    about 2 years ago

    By the way, I just downloaded the plugin this morning, so presumably it is after you put in the fix that you thought could possibly help Jon.

    Thanks,
    Mike

  • #19 written by Mike F.
    about 2 years ago

    So, sorry to inundate you with so many messages, but I looked through the code, and if I’m reading it right, it seems that a table should be created with a name of something like wp_az_index. Is that right? If so, I don’t see that table, and I’m wondering if the code just doesn’t return an error when attempting to create an index in that nonexistent table. I might try to manually create the table to see if it works. Anyway, just wanted to give an update.

  • #20 written by Jon Peltier
    about 2 years ago

    Unfortunately the new version has the same problem. Here’s the precise error message in the index page:

    ERROR: No index with the id of 1 was found.
    (Message from the AZIndex plugin)

    Mike F’s last post about the missing table makes sense. I wonder why it isn’t created for all users….

  • #21 written by English Mike
    about 2 years ago

    Hey Mike/Jon, that’s very strange — the demo page on this site is a live demo using the plugin, so it’s tough to know why it’s not working on your web sites when I can’t reproduce the problem.

    Yes, the plugin creates a table called “wp_az_indexes” and INSERTS an entry for each index you create. But if the table wasn’t being created, you wouldn’t see the indexes you create being added to the index table on the AZIndex admin page — which I assume you are seeing, right?

    If that’s true, then the problem would seem to lie with loading the database table when the short-code (az-index) (in square brackets) is encountered. That code is in az-index-admin.php:

    function set_vars_from_table($id) {
      az_trace('fn:set_vars_from_table');
      global $wpdb;
      $indexes = $wpdb->get_results("SELECT * FROM ".AZ_TABLE." WHERE pageid = $id");
      if (count($indexes) != 0) {
      ...

    The function returns the count of indexes in the table, which in your case must be zero for some reason. So it looks like this is the query that’s failing, but not always, which is very strange. ( ‘pageid’ is really the id of the index, I just didn’t want to rename the field in v0.2 and break users who didn’t uninstall the plugin between versions). The query is very basic SQL so I wouldn’t think that an older version of SQL is the issue either.

    If you wouldn’t mind, I’ve uploaded a debug version of az-index-admin.php which will dump out a couple of debug lines on your screen (in yellow):

    http://svn.wp-plugins.org/azindex/branches/debug/az-index-admin.php

    If you wouldn’t mind installing this on your system (in plugins/azindex) and let me know what it says.

    In the meantime I’ll keep looking. It doesn’t seem to be a plugin interaction issue, since I removed that likelihood with the fix that failed, so it’s probably a bug or incompatibility in my code somewhere.

    Thanks again for the continuing feedback.

    Mike

  • #22 written by English Mike
    about 2 years ago

    Oh, I should just double check. Can you create and edit indexes in the admin panel ok? You know, creating a index, saving it, then clicking on “Edit” again and all the options you set show up ok?

    If that’s all working then the database table is ok — it’s just this query in the comment above that’s failing for some reason.

  • #23 written by Jon Peltier
    about 2 years ago

    In the Manage AZIndexes page I see this after adding an index:

    Index added successfully.
    No index pages found.

    I cannot edit an existing index because none are found.

    Here is the text of the index page:

    fn:set_vars_from_table; query index id = 1
    fn:set_vars_from_table; rc = Array; index count found: = 0
    fn:set_vars_from_table; rc = Array; index count found:a = 0
    query = SELECT * FROM wp_az_indexes WHERE pageid = 1
    fn:set_vars_from_table; rc = Array; index count found:b = 0

    ERROR: No index with the id of 1 was found.
    (Message from the AZIndex plugin)

    It seems that the table “wp_az_indexes” was not created: I can’t see it using phpMyAdmin, but all the other tables are present.

  • #24 written by English Mike
    about 2 years ago

    Thanks, Jon, that clears it up. No database table. Weird.

    I’m using the API: maybe_create_table(AZ_TABLE, $sql); on activating the plugin, and it doesn’t seem to be working. I guess the function is saying “maybe not!”

    (I should also do something about that misleading “index created” message you got. The plugin should notify the user if the database table doesn’t get created).

    I will look into why the table isn’t getting created and check back a bit later.

    Thanks again for the help.

    Mike

  • #25 written by English Mike
    about 2 years ago

    Hey Jon, I think we’re down to two possibilities -

    a) the plugin’s activation hook isn’t getting called.
    b) the database create table is failing

    I have updated the debug version of the code with a couple of extra trace statements:

    http://svn.wp-plugins.org/azindex/branches/debug/az-index-admin.php

    The output won’t appear on the screen so it has to be written to a file on your server. The file is called ‘az-trace’ but I’m not sure where PHP will put it — on my system it’s put in the WordPress root directory.

    I also replaced the maybe_create_table function (though it looks perfectly ok to me) with a direct $wpdb->query(CREATE) call, just to see what happens.

    Reactivate the plugin and go to the AZIndexes page. That should put enough stuff into the az-trace file to see what’s happening.

    The trace output should look something like:

    fn:az_plugin_activate : start

    CREATE TABLE wp_az_indexes ( name text NOT NULL, pageid int NOT NULL, categories text, tags text, heading text, subheading text, description text, columns tinyint, headingseparator text, itemsperpage smallint, customcsssingle text, customcssgroup text, options set('add-spaces', 'group-subhead', 'alpha-links', 'alpha-links-unused', 'alpha-links-two-rows', 'multipage', 'multipage-links-above', 'multipage-links-below', 'custom-css'), PRIMARY KEY(pageid));

    0
    fn:az_plugin_activate : end

    If you can’t see all that in the az-trace file, then WordPress isn’t calling my activation routine for some reason.

    I’m dumping out the SQL statement to see if that’s the issue. You can try cutting and pasting it and running it in PHPMyAdmin to see if that creates the table for you. At least then you’ll be able to play with the plugin!

  • #26 written by Jon Peltier
    about 2 years ago

    I swapped files again. Here are the results:

    1. I can’t find the az-trace file. I looked in the WordPress root, the directory above that, all the directories between WordPress and the azindex subdirectory under the plugins directory.

    2. I received the same output trace as before in the index page.

    I presume everything starting with CREATE and ending with the semicolon constitutes the SQL statement that adds the table? I’ll see if adding the table manually is good enough.

  • #27 written by Jon Peltier
    about 2 years ago

    Hmmm, ran the SQL, but got an error:

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘columns tinyint, headingseparator text, itemsperpage smallint, customcsssingle t’ at line 1

    I’m a SQL copy-paste expert, but not too good at generating my own SQL or debugging. The MySQL version is 4.1.20-log, FWIW.

  • #28 written by English Mike
    about 2 years ago

    Thanks, Jon. Well, it looks as though I’m going to have to install MySQL 4.1 :-)

    I’ll get back to you when I’ve checked it out.

  • #29 written by English Mike
    about 2 years ago

    Ugh — I finally figured it out… By process of elimination (and I eliminated just about everything else in the query first!) it turns out that MySQL 4.1 doesn’t like me using “columns” as a field name. Obviously not an issue for 5.0, but 4.1 squeals loudly when you use it. (I’m guessing it’s a reserved word in 4.1 and that 5.0 relaxed the restriction on it.)

    Ah well, thanks again to Mike F. and especially Jon for your feedback while I chased bugs down the wrong rabbit holes. I will rename the columns field and upload a new version of the plugin for you all to try out. I will also add some more error checking to the code in the near future so that problems like this are less painful for me and the user to figure out.

  • #30 written by Jon Peltier
    about 2 years ago

    Mike -

    Thanks for your diligence in figuring this out. I was starting to feel like a PITA, but I know I appreciate it when users of my lame little apps follow up with debugging details.

  • #31 written by Jon Peltier
    about 2 years ago

    I was installing another plugin and noticed the link to a new version of AZIndex. Click.

    I created a new index, it appeared in the list, and when I previewed the page it gave me a list of all of my posts.

    Excellent! And thanks for keeping on it.

  • #32 written by Mike F.
    about 2 years ago

    I concur: thanks again Mike! I never would have guessed that it was a reserved word issue.

    I’ll try installing again now.

  • #33 written by English Mike
    about 2 years ago

    One word…. phew!

    :-)

    Thanks for the confirmation that you’re up and running, Jon. You need not have worried about being a pain. I’ve been a software developer and tester for over 20 years, so I can usually tell pretty quickly who the awkward customers are , and you are definitely not one of them.

    Thanks again,

    Mike

  • #34 written by Lionel Chollet
    about 2 years ago

    Hi,
    thanks for the plugin!

    What would be nice: a way to add the easy index-ordering capabilities of AZ-Index to regular archive pages (i.e.: complete with any data that one may want to display in an archive page… post’s picture, metadata and so on), and a way to add natural order in numbers used in custom fields.

    I’d like to order my archive pages according to a custom field value that’s the article’s product reference number, and it would be great that “24283″ came after “3768″.

    I couldn’t manage to order my archive the way i’d like to, even after reading http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query (admittedly, I’m so a n00b).

  • #35 written by English Mike
    about 2 years ago

    Hi Lionel. I get what you’re saying about custom queries, I struggled with the query_posts() for a while before deciding to use a direct MySQL query instead. There were a couple of bugs in query_posts() that I could not work around easily. So don’t feel bad about not figuring it out!

    Anyway, in regards to your questions. First, I figured out how to include an index in a template file (which is what I think you need). You can’t just add the [az-index id="1"] short code because it doesn’t get passed to the AZIndex plugin if it’s not in a post or page. What you can do is add something like this to the template (below the main post loop):

    <?php
       query_posts('pagename=index-page');
       while (have_posts()) : the_post();
          the_content();
       endwhile;
    ?>

    where ‘index-page’ is a page containing the [az-index] shortcode. I tested this and it seems to work ok.

    Now, regarding your “natural ordering” request. It’s an interesting idea, though not exactly in the spirit of alphabetical indexing :-) . So I’m not sure really sure it’s a good fit for this plugin (though I won’t rule it out yet!).

    However, there are a couple of things you could try yourself:

    1. Add leading zeros to make the product reference numbers all the same length (I’m sure you’ve considered this one already).
    2. The sort comparison function (az_compare) is in the plugin file az-index-content.php. (the file is in wp-content/plugins/azindex in your WordPress installation). You are welcome to replace it with one that meets your needs. For example:

      function az_compare($in1, $in2) {
         $result = intval($in1['head']) - intval($in2['head']);
         return $result;
      }

      This function compares two integer values in the Heading fields (a custom field you define or the excerpt) and will sort the index into the natural order you’re looking for. If the only thing you’re sorting on is the reference codes, then add those codes to a custom field (or excerpt) and use that field as the heading for the index. You can still define sub-headings and descriptions and they will be displayed but they won’t be used in this simple sort. This should work for you, but you do have to remember that upgrading to a new level of the plugin will overwrite any changes you make and you will have to add it back, so it’s not ideal.
    3. I will add your request to the list, but at the moment I really have to figure out how to cache indexes so the plugin can be used safely with large indexes, and there are a few other issues I have to resolve.

      If you have any questions about anything I’ve said here, feel free to ask.

      Mike

  • #36 written by English Mike
    about 2 years ago

    Lionel, since I wrote the comment above yesterday, I realized that there is a nice way to integrate what you want into the AZIndex plugin. Similar to my second suggestion of replacing the comparison function with one that you need, I see no reason why an “advanced” option (i.e. one requiring a little programming) could not be to specify your own compare function (i.e. a replacement for az_compare() in the plugin) that you add to, say, functions.php in your theme directory. That way anyone can quickly tailor the sort to their own satisfaction.

    Now, I haven’t played with that idea yet, so I’m not 100% sure that it’s as easy as that, but I will put it on the list of things to do, so when I finally get to version 1.0 (hopefully later this month) check back and see if you have what you need.

    Mike

  • #37 written by Nick
    about 2 years ago

    I’ve noticed in WP 2.5.1 that the Shift This Thumbnail Size 1.0 plugin isn’t having any effect.

  • #38 written by Nick
    about 2 years ago

    …oops submitted one comment to the wrong blog and another to a different one. Must have taken my stupid pills this morning.

  • #39 written by English Mike
    about 2 years ago

    :-) No worries!

  • #40 written by Lionel Chollet
    about 2 years ago

    Hello Mike,

    thanks for the replies, I’ll test your ideas tomorrow, er, today already, but later on!

    Best regards,
    -Lionel

  • #41 written by Danny
    about 2 years ago

    Mike,

    Sweet plugin. There are many applications for this and it turns wp that much more into a flexible cms. Cheers.
    Just wanted to say great plugin. I would love to see caches and the ability to sort pages!

    Cheers
    danny

  • #42 written by Danny
    about 2 years ago

    actually, id have a question. do you have any easy way to set alternate class’ on the li so you can zebra-stripe the lists?

    i guess you’d have to go into a-zcontent.php right now to do this?

  • #43 written by English Mike
    about 2 years ago

    Hey Danny, glad you like the plugin. Thanks very much for the feedback. I do intend to add caching and page support (if that’s what you mean?) in the near future. I had a self-inflicted catastrophe with my new laptop last week which set me back somewhat, but should know in a couple of hours if they fixed it under warranty, so hopefully I will begin to update the plugin again soon.

    As for zebra-striping. That’s a very good idea. You are correct in that it’s not something you can add using the custom CSS. I honestly hadn’t considered the idea as something suitable for an index, but I’ll add it to the todo list and take a look. Curiously enough, I recently hacked WordPress to allow the same thing for sidebars — if you notice the sidebar on this blog is “striped” and it’s not hard-coded in the HTML — if I insert another widget into the sidebar, the alternating colors for the widgets still work. It was a bit of a hack, but I might write a post on how to do it at some point.

  • #44 written by Graeme
    about 2 years ago

    Hi there, this is a fantastic plugin. It works superbly with just the default settings and title, but when I add any sort of category or tag I get the following error. Would love to try and work out why.

    Fatal error: Call to undefined function: htmlspecialchars_decode() in
    ……../wp-content/plugins/azindex/az-index-admin.php on line 899

  • #45 written by Graeme
    about 2 years ago

    actually in relation to the error in the post above. The AZ Index plugin works beautifully with all the category or tag controls when running a development locahost wordpress site, I have the above problems when trying to implement on the live site. Therefore something must be blocked or not copying over maybe due to read / write permissions ??

  • #46 written by English Mike
    about 2 years ago

    Hi Graeme,

    Thanks for your feedback. It looks as though htmlspecialchars_decode() is a PHP 5-only API (a fact I missed when I added it to the plugin). That means your live production site is probably still using a version of PHP 4.x and the plugin fails. From looking at the comments attached to the API in the PHP manual, it looks as though it might be possible to substitute the offending API for another function which would work.

    Now I have my laptop back from the repair shop, I’ll take a look at removing that dependency on PHP 5, but I should warn you that, as I said in the release notes, there might be others. Keep an eye open for a new beta release later this week.

    Mike

  • #47 written by English Mike
    about 2 years ago

    By the way, depending on who you are using as your web host, you might be able to upgrade your server to PHP5 from the server’s control panel. That’s what I did on the server running this blog. Mind you, that would be a drastic step to take to fix this one problem you’re having, so you should be think carefully before you do it since other aspects of your server might break. However, if you’re just running WordPress 2.5.x and nothing else, then it should be reasonably safe to do it.

    Mike

  • #48 written by Graeme
    about 2 years ago

    Hi Mike,

    Just to let you know, I’ve downloaded the latest beta release and this has resolved the problem. It’s perfect!! This is a brilliant plugin and thanks so much for taking the time to resolve the issue. This now enable me to index various posts into specific groupings or either category or tags.

    Great Job!

  • #49 written by English Mike
    about 2 years ago

    Thanks for the feedback, Graeme, and I’m glad it’s working for you. Feel free to let me know if you run across any other problems. Thanks to your testing, it looks as though my plugin supports PHP4 as well as PHP5.

    Mike

  • #50 written by English Mike
    about 2 years ago

    Danny, FYI, while the CSS isn’t obvious (those darned “floats” are a real pain!), I figured out a way to do striping of the index entries with a small modification to the plugin code. So look out for it as a new feature in the next version of the plugin.

    Mike

1 2 3 ... 5

Comments are closed.