With the professional edition of SiteXpert you can insert items into the sitemap (dynamic tree style only) dynamically, from a server-side script such as ASP or PHP. This is very useful if you want to reflect a structure stored in a database or enable/disable items based on user's permissions. You can enable dynamic generation in options / tree properties / dynamic creation of structure. Please note that this will not work with the 'optimize for huge tree structures' option.
Adding items to sitemap
When dynamic creation is enabled, in the ouput page created by SiteXpert you will notice a PHP / ASP function which should be called to dynamically add items to sitemap. Please note that when dynamically creating sitemaps, you don't specify the position of items -- all items are always inserted at the end of a given sitemap folder (or top-level list). The code for dynamic sitemap creation should be inserted just after the Add items to the sitemap here comment (the program will also create default code at this location -- this code will create a sitemap designed inside the program's UI). Below is the description of the function you'll need to use:
function SSInsertItem (or insertItem when using JavaScript) -- call this function for each item to be added to the sitemap. The function returns the id of the created item (this id can be used as the parentItem parameter when adding child items to this item, thus making it a folder). This function accepts the following parameters:
Here's a sample code (PHP version) which creates a sample sitemap:
... // ----------------------------- // Add items to the sitemap here // ----------------------------- $dir1=SSInsertItem(true,null,"Sample folder 1","","","#"); SSInsertItem (false,$dir1,"Item","","","#"); $dir2=SSInsertItem(true,$dir1,"Subfolder","","","#"); SSInsertItem (false,$dir2,"Item opened in a new window","Clicking this item will open MSN.com in a new window","_blank","#"); $dir3=SSInsertItem(true,null,"Sample folder 2","","","#"); SSInsertItem (false,$dir3,"Item","","","#"); ...
The above sample will result in the following structure being created:
Sample folder 1 Item Subfolder Item opened in a new window Sample folder 2 Item