PDA

View Full Version : vBSEO Sitemap Addon


Pages : [1] 2

aproape
09-15-2008, 07:25 PM
Good morning everyone!

OK - today is going to be a good day in Dynamics' history I think! ;-)

Two more addons for it.. so let's start with the first one:

vBSEO Sitemap addon!

This code requires that vBSEO is already installed and working properly AND that vBSEO Sitemap is installed and working properly [generating regular sitemaps] already.

What this addon does: it adds the Dynamics URLs for all categories and articles in the system to the vBSEO Sitemap [after the forums URLs].

The URLs used are preserved as the ones from Dynamics [SEO friendly].

Default weight is 1.0 for categories and 0.5 for articles. Default frequency is daily for categories and weekly for articles.

Installation:

Step 1: Extract from .zip and copy the attached file to /forums_directory/vbseo_sitemap/addons/ directory.

Step 2: IMPORTANT: Edit this file to specify the location of your Dynamics installation [domain name + dynamics directory]

Step 3: Enter the filename of the module [vbseo_sm_dynamics.php] into the [Addon Generator Modules] section of vBSEO Sitemap Settings from AdminCP.

Step 4: Re-generate the sitemap using the vBSEO Sitemap Reports link or wait for it to be re-generated..

Step 5: OPTIONAL: edit the values for frequency and importance from this module's .php file [weight is given 1.0 for categories and 0.5 for individual articles - with daily for categories and weekly for articles]. Change those if you want to better suit them to your needs.

Enjoy! :-)


Cheers,
aproape

P.S. Thanks for deathemperor for the initial sharing of his code which we adapted to use the Dynamics SEO URLs.

aproape
09-15-2008, 08:04 PM
Good morning everyone again!

One more detail - I guess for multiple instances of Dynamics you can just copy this addon with a new name like vbseo_sm_dynamics_02.php and add it just as a second addon to vBSEO Sitemap settings.. [and modify the directory and table names inside the file of course].

I don't have multiple Dynamics instances to test.. if anyone else [Larina? :-)] has other ideas/input - feel free to contribute!


Cheers,
aproape

Our Sponsors
 

larina
09-15-2008, 08:22 PM
Hi aproape,

one day I will ask you, if you will marry me :D

Boah, I am so happy about this addon!!! Thank you!!

I am having a problem and don't know why ...

In all URLs shown in the sitemap, the category-part is missing.

So for all my dynamics categories I have one same link like that:
http://www.domain.com/dynamics/

Somehow for links to entries the entries names are included into the link, but the category part still misses. So links to entries do look like that:
http://www.domain.com/dynamics/entry1.html
(it should look like that: http://www.domain.com/dynamics/category1/entry1.html)

Do you have an idea, how this can happen? I changed the table name of categories to the one I use, is there something else to change?

larina

aproape
09-15-2008, 08:28 PM
Hi there Larina!
Hi aproape,

one day I will ask you, if you will marry me :D


Just let me know when so I won't choke or blink too fast!:-)



In all URLs shown in the sitemap, the category-part is missing.


Hmm.

Do you have access to the DB directly?

Can you run this query from the addon:

SELECT * FROM " . TABLE_PREFIX . "adv_dyna_categories;

[replacing the TABLE_PREFIX and the "adv_dyna_categories" table with the one[s] you use?]

Sounds to me like this query returns empty.. for some reason..

Let me know if you can run that - thanks!


Cheers,
aproape

Our Sponsors
 

larina
09-15-2008, 08:42 PM
Hi aproape,

yes, I can run this query and it does function.

Hmm, I compared to the old sitemap dynamics plugin, and the query is the same. In the old plugin it was working.

larina

larina
09-15-2008, 08:52 PM
I think it finds all the categories, as there are many links like that:
http://www.domain.com/dynamics/
(should be as much as I have categories).

In the old Plugin (without SEO-links) I used this line to call the categories:
$lnkg = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "rezepte_categories WHERE active = 1");
This does work.

In your Plugin I use this line:
$cats = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "rezepte_categories");

Should be about the same, except the part "active". I also tried the old call in the new Plugin, but with the same result.

aproape
09-15-2008, 08:55 PM
Hi there Larina,

Hi aproape,

yes, I can run this query and it does function.


That's good and bad both :-)


Hmm, I compared to the old sitemap dynamics plugin, and the query is the same. In the old plugin it was working.



Yes, because the old plugin doesn't use the Dynamics functions.

Sounds to me like there is some trouble using the [fetch_cat_url] and [fetch_entry_url] functions.. maybe when Dynamics is installed on multiple instances?

Hmm. How much do you trust your possible future mate? :-)

I would need to see what the output of those functions is.. and debug a bit. We can probably exchange contact info via PM.

Not sure if they need to be used differently in a multi-instance situation - for a single installation the sitemap is generated without any issues..

==

Can anyone else confirm this.. is anyone else experiencing the same problem?


Cheers,
aproape

[almost taken - need a couple more plugins probably? :D]

larina
09-15-2008, 08:58 PM
Oh I trust my possible future mate very much! :)

Sure, tell me what you need from my side, if you which via PM.

larina

aproape
09-16-2008, 12:49 AM
Good morning Brian,

OK - after a bit of troubleshooting with Larina [ :-) ] - the following issue was found..

The sitemap addon is using the fetch_cat_url function - which is called with the catid variable.. to extract the friendly URL.

I have confirmed already that the id is passed correctly and the function does gets the proper value..

However - when the URL returns [either spider-friendly or not] it's empty - it seems that somewhere on calling fetch_cat_url or inside there - the id is lost.. and.. it's broken.

Any idea what can do that.. ? Or.. where/how to test it further - to find out?

On my system - the addon works flawlessly..


Cheers,
aproape

deathemperor
09-16-2008, 06:24 AM
thank u to share it

larina
09-18-2008, 08:51 PM
Hi Brian,

would you mind to take a look at aproape's post #9 ?

Why does this work for others but not for me? Perhaps as I try to use this for the second instance of dynamics? What can I do?

larina

tintin74
09-19-2008, 05:28 PM
aproape:

It works like a charm!

A big big big Thank you!

aproape
09-19-2008, 11:20 PM
Heya tintin!

You're welcome ;-)

--

Sorry Larina.. I will make sure it's working before the vows!! ;-)


Cheers,
aproape

larina
09-22-2008, 07:32 AM
--

Sorry Larina.. I will make sure it's working before the vows!! ;-)


Cheers,
aproape

Thank you for your help with this, it works like a charm now! :)

larina

mattysheff
10-09-2008, 03:35 PM
Hi,

When generating a new site map I get the following error:

Fatal error: Call to undefined function fetch_cat_url() in /homepages/35/d259872388/htdocs/quk/forum/vbseo_sitemap/addons/vbseo_sm_dynamics.php on line 21

larina
10-09-2008, 04:55 PM
Hi mattysheff,

in the latest release of dynamics, the dynamics-function fetch_cat_url has been renamed to dyna_fetch_cat_url. So you need to change the file vbseo_sm_dynamics.php like that:

Find
$url = fetch_cat_url($cat['catid']);

and replace it with
$url = dyna_fetch_cat_url($cat['catid']);

larina

mattysheff
10-10-2008, 03:05 PM
Thanks I've tried that but still seem to be getting the same error.

larina
10-10-2008, 03:16 PM
Oh well, I just wanted to upload my whole file for you, but it does not produce seo-friendly-url's anymore :( No errors like yours, but no seo-url's. They must have been lost with a fix Brian made for dynamics, cause after the first install of the latest dynamics-version the sitemap-plugin was working fine.

Probably we'll have to wait until aproape made an update for the hack, I saw him posting today in another thread, that this is on his plan.

larina

larina
10-26-2008, 04:26 PM
I took the time to look deeper into it and found out, that the fix aproape gave to me earlier is working fine with the new dynamics version. Sorry, somehow I was trying the version in this thread after upgrading.

Anyway, I have attached the file which is working. Be sure you follow the instructions at the top of the file.

For multi-instances you need to replace adv_dyna in the file everywhere it appears with the table-name you use for your instance (only where adv_dyna is written in small letters).

larina

mattysheff
10-26-2008, 05:29 PM
Thanks

mattysheff
12-12-2008, 09:29 AM
Will this still work with the new version

larina
12-12-2008, 04:27 PM
I have not found the time to update to the latest versions of vbA-Software yet. I'll let you know when I am done with it and have tested the Addon.

I hope not to forget it. Feel free to ask again, if I have not posted here within the next two weeks.

larina

aproape
12-28-2008, 10:20 AM
Good morning Larina!

Hmm.

Two weeks just passed! *smile*

[Merry Christmas, by the way!!]

larina
12-28-2008, 10:50 AM
Hi aproape :)

Huch, yes, two weeks have passed :D

I was moving my website to another server, the dynamics-update is the next I'll do. Tomorrow at the latest I'll give feedback, if the plugin than still is working.

Merry Christmas, also to you! :)

larina

larina
12-28-2008, 09:25 PM
Yes, the plugin is still working fine after the dynamics-update :)

aproape
12-30-2008, 06:15 PM
mmm.. thank you!

: )

We will upgrade our base as well sometime in the next year and give feedback if anything needs updated : )

Happy New Year to you, Larina - and the rest of Dynamics community!


Cheers,
aproape

mrscripto
01-29-2009, 03:09 AM
I have tried both of these files with the latest version of dynamics, the one that larina posted and the original. Both almost work, but neither pull the category name into the url. Any updates on this? Thanks

larina
01-29-2009, 12:10 PM
Hmm, the problem I had with the original-script, when using multi instances of Dynamics. Have you followed the instructions written at the top of the file I uploaded?

Add a plugin from the Vbulletin's admincp with the details:
1. Add-on: vBulletin
2. Hook Location: init_startup
3. Title: FOR VBseo sitemap inclusion of Dynamics URLs
4. Plugin PHP Code: $datastore_fetch[] = "'adv_dyna_cats'";
5. Active: Yes

At least for multi-instances it seems this plugin is required. While I made a fresh install of dynamics later with only 1 instance, but still use this plugin and the file I uploaded, and everything is working fine.

larina

larina
01-29-2009, 12:13 PM
adv_dyna_cats
in the plugin you would need to rename to the table-name you use, in case you use multi-instances.

J_Caesar
01-30-2009, 06:55 PM
Thanks :)

mrscripto
01-31-2009, 10:26 PM
Hmm, the problem I had with the original-script, when using multi instances of Dynamics. Have you followed the instructions written at the top of the file I uploaded?

Add a plugin from the Vbulletin's admincp with the details:
1. Add-on: vBulletin
2. Hook Location: init_startup
3. Title: FOR VBseo sitemap inclusion of Dynamics URLs
4. Plugin PHP Code: $datastore_fetch[] = "'adv_dyna_cats'";
5. Active: Yes

At least for multi-instances it seems this plugin is required. While I made a fresh install of dynamics later with only 1 instance, but still use this plugin and the file I uploaded, and everything is working fine.

larina

I started over and did each step and now the URLS are working, thanks for the response. :)

tintin74
02-21-2009, 07:23 PM
Hello Larina.

I'm running 3 instances of dynamics and I've tried to solve what I think is a bug, today, but without success. After several hours our work ( I'm not a programmer) I ask to you some help, please.

I've read , some other people is fighting with this problem here:

http://www.vbseo.com/f66/vbadvanced-dynamics-sitemap-inclusion-17137/index2.html#post169720

---

This is my modified code:

<?php
/******************************/
//Dynamics vBSEO Sitemap Addon v1.0
// Copyright aproape/Maribal Inc. 15 Sep 2008
// Replace the URL below with your vBa Dynamics main folder URL

require_once('includes/vba_dyna_functions.php');

if(VBSEO_ON)
{
$vba_options['dyna_spiderurls'] = true;
}

$vba_dyna_url = 'http://www.mydomain.com/default-istance/';
$vba_second_url = 'http://www.mydomain.com/second-istance/';


//adding the categories to the sitemap
$cats = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "adv_dyna_categories");
while ($cat = $db->fetch_array($cats))
{
$url = dyna_fetch_cat_url($cat['catid']);
/*if(VBSEO_ON)
$url = vbseo_any_url($url);*/

$url = $vba_dyna_url . $url;

vbseo_add_url($url, 1.0, $cat['lastupdated'], 'daily');
}


//adding the articles/entries to the sitemap
$entries = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "adv_dyna_entries WHERE open > 0");
while ($entry = $db->fetch_array($entries))
{
$url = fetch_entry_url($entry);

/*if(VBSEO_ON)
$url = vbseo_any_url($url);*/

$url = $vba_dyna_url . $url;

vbseo_add_url($url, 0.5, $entry['lastupdated'] ? $entry['lastupdated'] : $entry['dateline'], 'weekly');
}

//adding the categories to the sitemap
$cats = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "adv_second_categories");
while ($cat = $db->fetch_array($cats))
{
$url = dyna_fetch_cat_url($cat['catid']);
/*if(VBSEO_ON)
$url = vbseo_any_url($url);*/

$url = $vba_second_url . $url;

vbseo_add_url($url, 1.0, $cat['lastupdated'], 'daily');
}

//adding the articles/entries to the sitemap
$entries = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "adv_second_entries WHERE open > 0");
while ($entry = $db->fetch_array($entries))
{
$url = fetch_entry_url($entry);

/*if(VBSEO_ON)
$url = vbseo_any_url($url);*/

$url = $vba_second_url . $url;

vbseo_add_url($url, 0.5, $entry['lastupdated'] ? $entry['lastupdated'] : $entry['dateline'], 'weekly');
}

?>


The results for running this script is:

The first istance urls in the sitemap are showing without any errors, no problems at all.

Categories:

hxxp://www.mydomain.com/default-istance/default-istance-category-10/
hxxp://www.mydomain.com/default-istance/default-istance-category-11/
hxxp://www.mydomain.com/default-istance/default-istance-category-12/
hxxp://www.mydomain.com/default-istance/default-istance-category-13/
.....

Entries:

hxxp://www.mydomain.com/default-istance/default-istance-category-10/first-istance-entry-title-25.html
hxxp://www.mydomain.com/default-istance/default-istance-category-10/first-istance-entry-title-26.html
hxxp://www.mydomain.com/default-istance/default-istance-category-10/first-istance-entry-title-27.html
hxxp://www.mydomain.com/default-istance/default-istance-category-10/first-istance-entry-title-28.html
.....

In the second istance map I see:

CATEGORIES:

hxxp://www.mydomain.com/second-istance/default-istance-category-10/
hxxp://www.mydomain.com/second-istance/default-istance-category-11/
hxxp://www.mydomain.com/second-istance/default-istance-category-12/
hxxp://www.mydomain.com/second-istance/default-istance-category-13/
hxxp://www.mydomain.com/second-istance//[/url]
hxxp://www.mydomain.com/second-istance//[/url]
hxxp://www.mydomain.com/second-istance//[/url]
hxxp://www.mydomain.com/second-istance/second-istance-category-200/
hxxp://www.mydomain.com/second-istance/second-istance-category-201/
hxxp://www.mydomain.com/second-istance/second-istance-category-202/
hxxp://www.mydomain.com/second-istance/second-istance-category-203/

NOTE: I see into some urls the first istance categories, into some other // and the correct second istance categories into some other urls.... (cats id conflict? )

ENTRIES:

hxxp://www.mydomain.com/default-istance//second-istance-entry-title-25.html
hxxp://www.mydomain.com/default-istance//second-istance-entry-title-26.html
hxxp://www.mydomain.com/default-istance//second-istance-entry-title-27.html
hxxp://www.mydomain.com/default-istance//second-istance-entry-title-28.html

Everything ok but the categories doesn't appears. Strange.

I think there's some problem with categories id coming from several istance, but I've no idea to How solve the quiz...

I hope to have explain the question better as possible...

Thank you

Tintin

larina
02-21-2009, 11:53 PM
Hello tintin,

I am also no programmer, just can guess. Did you create a plugin as I wrote in posts #28 and #29 for every single instance you use? (so 3 plugins in your case, as you use 3 instances of dynamics)

This would be the first I'd check.

larina

tintin74
02-22-2009, 06:18 AM
Yes Larina, if plugin is active or inactive , nothing change...

larina
02-22-2009, 11:32 AM
I am sorry tintin, probably I cannot help you :( Perhaps aproape has an idea?

Perhaps there is just something wrong in your php-file. I wouldn't use one single php-file for all instances anyway.

I would take the file I uploaded in post #19 ... make the necessary changes for the 1st instance in this file ... upload it ... create the plugin for the 1st instance ... put the name of this file into the sitemap-options ... and test it.

If this works I would repeat these steps for the 2nd instance ... again take the file in post #19 ... edit it to suit to the table names and URL of your 2nd instance ... rename the file to whatever you want and also upload it ... create the plugin for the 2nd instance (also here you have to change the php-code to the table-name you use for the 2nd instance) ... than also put the name of this php-file into the sitemap options ... and also test it.

Same for 3rd instance.

I don't know why this should not work. And I am not really sure if it's clear for you, that the different instances of dynamics are working completely independent to eachother. They all have their own tables in the database with their own table-names. So if you can get this script running for one of your instances, just repeat the steps again for your other instances, while you just have to create a new php-file and a new plugin for each instance, change the tables-names and URL in the php-files and in the plugins, and surely also have to change the name of the php-file for each instance in order not to overwrite the others.

larina

deathemperor
04-15-2009, 02:13 PM
not work with multiple instances
i test larina hack also not work for multiple instances
it works just for few links but my site has 10 instances with more than 50 thousnads entries

alot of entries made with links without the ctegory name and id !

larina
04-15-2009, 02:17 PM
Every instance needs its own plugin, perhaps you forgot this? Instances without their own plugin won't take the category names into the sitemap-links.

larina

deathemperor
04-16-2009, 07:25 AM
i will explain what i get
for default vba dyna
it works perfect

for another instance for example books with :
define('ADV_DYNA_PREFIX', 'books');

i add the plugin to be
$datastore_fetch[] = "'books_cats'";

and at this step is not work
also dyna url still show the first instance hoem url and links

i research the code of the php file
i get this :
$vba_options =& $vbulletin->vba_dyna_opts;

i make the new file for books sitemap
to be
$vba_options =& $vbulletin->books_opts;

and then the url works
i change also
$url = $vbulletin->adv_dyna_cats[$cat['catid']]['surl'];
$vbulletin->adv_dyna_cats[$cat['catid']]['surl'] = $url;
to be
$url = $vbulletin->books_cats[$cat['catid']]['surl'];
$vbulletin->books_cats[$cat['catid']]['surl'] = $url;
because if i did not , it will show the categories of the default one


untill now after i modified the codes to work with my second instance "books"
the url of categories work perfect
but

the url of entries still show the categories of the first instance so it will has the name of category in the first one not in second instance

i think we need some code to make the second instances works for entries seo url

Crazy-Achmet
05-07-2009, 07:46 PM
the url of entries still show the categories of the first instance so it will has the name of category in the first one not in second instance

i think we need some code to make the second instances works for entries seo url

Same problem here! :(

aproape
06-12-2009, 12:32 AM
Err.. umm.. hi guys!

I just resurfaced : )

Is help still needed with this.. ?


Cheers,
aproape

Crazy-Achmet
06-12-2009, 04:45 AM
Hey,

yes i (we) still could need some help! ;)

deathemperor
08-05-2009, 10:38 PM
i explain issues with mlutiple instances so plz try fix it

Webs961
08-15-2009, 09:36 AM
By the way, I have a fix for the multiple instances issue for you coding-types.

You can't DEFINE more than once; you're trying to define ADV_DYNA_PREFIX more than once if you have multiple instances. It just needs to be changed to a variable, not a definition. Problem solved. :)

NJAquaman
08-16-2009, 03:43 PM
By the way, I have a fix for the multiple instances issue for you coding-types.

You can't DEFINE more than once; you're trying to define ADV_DYNA_PREFIX more than once if you have multiple instances. It just needs to be changed to a variable, not a definition. Problem solved. :)

Example Please !!!
It would help a lot !

Thanks

deathemperor
09-10-2009, 07:38 PM
any update to make it work for multi instance

SoloX
01-17-2010, 12:31 PM
^ ditto.
Would deeply appreciate if this mod is made to work with multiple instances.

JWL
03-29-2010, 04:46 PM
Just reporting still working strong in VB 3.8.5 Although the change
$url = dyna_fetch_cat_url($cat['catid']);

needs to be corrected in the download file :)

tavenger5
11-04-2010, 03:07 PM
anyone using this with 2.x of dynamics and vb4?

tavenger5
11-05-2010, 12:37 PM
nevermind - I got this to work with the above change by JWL for 4.0

tfw2005
11-09-2010, 08:01 PM
RE: Multiple Instances -

I think I figured a way to fix this.

Go to your vba_dyna_functions.php file in the includes folder of your forum root.

Search for // ##### Fetch Entry URL

Copy that entire Function

Paste it into the vbseo_sm_dynamics.php file right under //ADDING THE ENTRIES IN THE SITEMAP

Rename the function to - function fetch_entry_url2

Find $cats = $vbulletin->adv_dyna_cats and change adv_dyna to your second, third, 4th instance name etc.

Find - $entry_rel_url = fetch_entry_url($entry);

and change that to

$entry_rel_url = fetch_entry_url2($entry);

You must create a separate file for each instance, and follow all instructions in this thread prior to this post before doing this.

I'm sure there is a less bloated way to do this.

Basically when you called fetch_entry_url, when referencing it from the global functions file, it did not apply your updated instance name you declared in the start of the file here. So it was still calling your default dyna instance variable in when creating category names for the entries.

By doing this, you keep the entire function in this file, and manually edit the secondary instance names, so it all works out.

So far. Not fully tested. But give it a try. Will not offer ongoing support, so back up and try at your own risk! Working for me on VBSEO 3.0.