Adding Pages via SQL

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/26/2013 6:46:42 AM
Gravatar
Total Posts 46

Adding Pages via SQL

Hi All,

I need to manually add an external link to the main menu of 300+ sites.

I looked into the add page functionality and noticed it uses the stored procedure mp_pages_insert

So i coded a cursor to cycle through every site and add a page using this stored procedure.

The record gets added to the database, but the page doesnt show up on the site! very confused! any ideas how to fix?

DECLARE @PageGUID uniqueidentifier
DECLARE @ParentGUID  uniqueidentifier
DECLARE @SiteGUID uniqueidentifier
DECLARE @SiteID int


DECLARE db_cursor CURSOR FOR  
SELECT SiteID FROM mp_Sites
OPEN db_cursor   
FETCH NEXT FROM db_cursor INTO @SiteID

WHILE @@FETCH_STATUS = 0   
BEGIN   

        SELECT @SiteGUID = Siteguid FROM mp_sites WHERE SiteID = @SiteID
        SELECT @PageGUID = NEWID()
        SELECT @ParentGUID = PageGUID FROM mp_Pages WHERE SiteID = @SiteID and PageName = 'Home'
        

       EXEC mp_pages_insert @SiteID, '-1', 'Shop', '20', 'All Users;', 'Content Publishers;', 'Content Publishers;', '', '',
0, 0, 0, '', '', '', '', 1, 'http://www.seacadetshop.org/', 0,0, 0, '', 1, '', 'Shop', 0, 'Daily', 0, '2012-09-07 10:23:19.050',
/* Page Guid */
@PageGUID, 
/*Parent Guid */
@ParentGUID, 0, 
/*Site GUID */
@SiteGUID,
'', '2012-09-07 10:23:19.050', 0, 1, 0, 0, '', 0,0,0,0, '00000000-0000-0000-0000-000000000000',
'', '', 0

       FETCH NEXT FROM db_cursor INTO @SiteID 
END   

CLOSE db_cursor   
DEALLOCATE db_cursor

2/26/2013 7:12:49 AM
Gravatar
Total Posts 18439

Re: Adding Pages via SQL

The site map is cached and I do not know of a way to clear the cache from sql. Touching the web.config file would clear the cache.

2/26/2013 7:26:26 AM
Gravatar
Total Posts 46

Re: Adding Pages via SQL

Thanks Joe, how would i clear it on my development version to double check it?

2/26/2013 7:27:21 AM
Gravatar
Total Posts 46

Re: Adding Pages via SQL

never mind got it, thanks a million Joe.

You must sign in to post in the forums. This thread is closed to new posts.