Page 1 of 2 1 2 LastLast
Results 1 to 15 of 17

Regarding sitemaps and its addons

This is a discussion on Regarding sitemaps and its addons within the General Discussion forums, part of the vBSEO Google/Yahoo Sitemap category; hello.. I have created a custom addon to extract dynamic urls from a mod of mine. Its working fine, but ...

  1. #1
    Senior Member webwizzy's Avatar
    Real Name
    Vinayak
    Join Date
    Aug 2008
    Location
    India
    Posts
    257
    Liked
    0 times

    Regarding sitemaps and its addons

    hello..

    I have created a custom addon to extract dynamic urls from a mod of mine. Its working fine, but I need to add more URL's to it. Here is the code.


    PHP Code:
    $lnkg $db->query_read("SELECT * FROM " TABLE_PREFIX "mytable");
        while (
    $lnk $db->fetch_array($lnkg))
        {
            
    $url $vbseo_vars['bburl'].'/mypage.php?do=this&uid='.$lnk['uid'];
            if(
    VBSEO_ON)
                
    $url vbseo_any_url($url);
              
    vbseo_add_url($url1.0'''yearly');
        } 
    What I don't understand is how to add more than 1 URL that are generated from the same query.

    1. As in above, mypage.php?do=this&uid=XX is added BUT how to add more URL's like mypage.php?do=that&uid=XX and so on from the same query. Do I need to run the same query again coz I see vbseo_add_url function doesn't accept more than one "url" as argument.

    2. Also, may I know how do we extract page URL's ? like I have 11 pages currently showing 8 records each, so how do I extract pages as their page no (id) isn't stored in database.

    Thank You

  2. #2
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    168 times
    Hello,

    1. You can just add this inside while() loop:
    PHP Code:
    $url $vbseo_vars['bburl'].'/mypage.php?do=that&uid='.$lnk['uid'];
            if(
    VBSEO_ON)
                
    $url vbseo_any_url($url);
              
    vbseo_add_url($url1.0'''yearly'); 
    2. That would depend on specific mod, for instance you might need to get the number of entries in that "category" with sql query, then divide it on page size to get the number of pages.

  3. #3
    Senior Member webwizzy's Avatar
    Real Name
    Vinayak
    Join Date
    Aug 2008
    Location
    India
    Posts
    257
    Liked
    0 times
    1. ah thank you, it works !
    2. Can you pleasee explain it programmatically ? my mod is simple and has just one table.
    This is my query:-

    PHP Code:
    SELECT FROM " . TABLE_PREFIX . "mytable ORDER BY `uidDESC LIMIT " . ($limitlower - 1) . "$perpage
    So this way, i am fetching/limiting 8 records per page. Now what should I do to extract pages ?

    thank you

  4. #4
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    168 times
    The code would look like:

    PHP Code:

    $entries_no 
    $db->query_first("SELECT * FROM " TABLE_PREFIX "mytable");
    $perpage 8;
    $pages_no ceil($entries_no $perpage);
        for (
    $pg 0$pg $pages_no$pg++)
        {
            
    $url $vbseo_vars['bburl'].'/mypage.php?do=this&page='.($pg+1);
            if(
    VBSEO_ON)
                
    $url vbseo_any_url($url);
              
    vbseo_add_url($url1.0'''yearly');
        } 

  5. #5
    Senior Member webwizzy's Avatar
    Real Name
    Vinayak
    Join Date
    Aug 2008
    Location
    India
    Posts
    257
    Liked
    0 times
    ohh thank you so so much sir ! It worked great.

    btw, I had to use query_read (instead of query_first) and $count = $db->num_rows($entries_no); (for division part) to get it all working.

    3. One thing left in my addon is extracting page URL's for Category pages like this and so on. I am not able to understand what and how the query would be run for it.

    My category search query is simple:-

    PHP Code:
    $db->query_read("SELECT * FROM " TABLE_PREFIX "mytable WHERE category = '$category'  LIMIT " . ($limitlower 1) . ", $perpage"); 
    and the original URL is links.php?do=search&cat=Chats and Forums&page=2

    4. I read somewhere that DISTINCT clause in SQL query isn't much efficient when there are a lot of records to search from. Is there an alternative for it (I found one but it was hard to understand for me).
    What can be the alternate query for this:-
    PHP Code:
    "SELECT DISTINCT category FROM " TABLE_PREFIX "mytable"

  6. #6
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    168 times
    3. Try this:
    PHP Code:
      $lnkg $db->query_read("SELECT * FROM " TABLE_PREFIX "category");  
        while (
    $lnk $db->fetch_array($lnkg))
        {
            
    $url $vbseo_vars['bburl'].'/links.php?do=search&cat='.$lnk['title'];
    .. 
    (assuming that 'title' is correct db field name)
    Last edited by Oleg Ignatiuk; 09-15-2008 at 06:48 PM.

  7. #7
    Senior Member webwizzy's Avatar
    Real Name
    Vinayak
    Join Date
    Aug 2008
    Location
    India
    Posts
    257
    Liked
    0 times
    3. But I need to extract page URL's for category pages just like you did in post #4.

  8. #8
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    168 times
    You will probably have to combine it with code from post #4 and created nested loop.

  9. #9
    Senior Member webwizzy's Avatar
    Real Name
    Vinayak
    Join Date
    Aug 2008
    Location
    India
    Posts
    257
    Liked
    0 times
    alright sir, I have it now working PERFECT, its grabbing all the inside category pages now !

    PHP Code:
    $lnkg $db->query_read("SELECT DISTINCT category FROM " TABLE_PREFIX "mytable");
        while (
    $lnk $db->fetch_array($lnkg))
        {
            
    $url $vbseo_vars['bburl'].'/links.php?do=search&cat='.$lnk['category'].'&order=desc';
            if(
    VBSEO_ON)
            
    $url vbseo_any_url($url);
              
    vbseo_add_url($url1.0'''yearly');
            
    $lnkc $db->query_read("SELECT uid FROM " TABLE_PREFIX "mytable WHERE category ='" $lnk['category'] . "'");
            
    $linkcount $db->num_rows($lnkc);
            
    $pages_no ceil($linkcount $perpage);
            for (
    $pg 1$pg $pages_no$pg++)
            {
                
    $url $vbseo_vars['bburl'].'/links.php?do=search&cat='.$lnk['category'].'&order=desc&page='.($pg+1);
                if(
    VBSEO_ON)
                    
    $url vbseo_any_url($url);
                  
    vbseo_add_url($url1.0'''weekly');
            }
        } 
    5. But what I want to know if there is a much efficient way to do the same. Coz there are 20 distinct categories and as the second query is within the while loop, it would run 20 times, right ?

    6. Is there a way to see some kind of debug info of addons ? (like query counts etc.)

    7. Can you please tell me, how do we convert titles into lowercase and replace blanks with a hyphen -. Just like vBSEO does for every forum, thread, etc. ?

    Thank You

  10. #10
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    168 times
    Hello,

    5. You can use a single query to find list of categories and counts:
    PHP Code:
      $lnkg $db->query_read("SELECT count(*) as cnt,category FROM " TABLE_PREFIX "mytable GROUP BY category"); 
    6. You should calculate this and output it in your add-on code.

    7. You can use vBSEO Functions for Extensibility for that (look for vbseo_filter_text($title) function).

  11. #11
    Senior Member webwizzy's Avatar
    Real Name
    Vinayak
    Join Date
    Aug 2008
    Location
    India
    Posts
    257
    Liked
    0 times
    5. Awesome
    6. Fine
    7. Superb

    Thank you so much for your help sir. I got my sitemap addon, CRR's and everything working perfect.

  12. #12
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    168 times
    You are very welcome

  13. #13
    Senior Member webwizzy's Avatar
    Real Name
    Vinayak
    Join Date
    Aug 2008
    Location
    India
    Posts
    257
    Liked
    0 times
    hii..

    after so many days I noticed a problem in my directory addon for vbseo sitemap. Maybe because I didn't tested it with vbseo turned off.

    okay.. my problem is that sitemap produces errors with the original URL's i.e. with vbseo turned OFF (it works perfect with vbseo ON)

    I'm getting the following error in sitemap:-

    Code:
    XML Parsing Error: not well-formed
    Location: http://mysite.com/sitemap_1.xml.gz
    Line Number 39, Column 54:  <loc>http://mysite.com/links.php?do=review&title=Vinayaks.com&uid=2</loc>
    ----------------------------------------------------------------------------^
    Please tell me whats wrong in the URL.

    Thank you

  14. #14
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    168 times
    Hello,

    are you using an add-on to include links.php?xx URLs in sitemap?

  15. #15
    Senior Member webwizzy's Avatar
    Real Name
    Vinayak
    Join Date
    Aug 2008
    Location
    India
    Posts
    257
    Liked
    0 times
    Yes sir... I'm using an addon as they are dynamic URL's generated off the database.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. vBSEO and official AddOns
    By Hoffi in forum General Discussion
    Replies: 4
    Last Post: 07-11-2007, 04:46 PM
  2. Custom Rewrite Rules for my addons
    By Snitz in forum Custom Rewrite Rules
    Replies: 0
    Last Post: 10-17-2006, 03:15 PM
  3. Custom Addons Rewrite
    By Amos in forum Troubleshooting
    Replies: 10
    Last Post: 10-14-2005, 02:53 PM

Tags for this Thread

Posting Permissions

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