Developer forum

Forum » CMS - Standard features » Databank page image header update

Databank page image header update

Andrew Mannell
Reply

Does any one have a script that could change the path of all page headers image (composition - Top Image) on a particular language layer, same priciple as this:

-------------------------------------------------------------------------------------
Run script to insert template on pages without templates set:
-------------------------------------------------------------------------------------
update Page
set PageLayout = 'Designs/GLOBAL_2011/Global_Subpage_2011_LowHeader_3_column.html'
WHERE     (PageAreaID = 191) and PageLayout = ''

 

Instead changing page header image path from

/Files/System/USA2010/images/header/header_middle_therapies.jpg

to:

/Files/Billeder/GLOBAL2014/headers/header_middle_partnerships.jpg

 

Thanks in advance

 

Andy

 

 

 


Replies

 
Mikkel Ricky
Reply

You could try something like

// Change image directory on pages
​update
    Page
set
    PageTopImage = replace(PageTopImage, '/Files/System/USA2010/images/header/', '/Files/Billeder/GLOBAL2014/headers/')
where
    PageTopImage like '/Files/System/USA2010/images/header/%'

Is it a typo that your example also changes "therapies" to "partnerships"?

Best regards,
Mikkel

 

 
Andrew Mannell
Reply

Hi Mikkel,

I have tried the following:

update Page
set PageTopImage = replace(PageTopImage, '/Files/System/USA2010/images/header/','/Files/Billeder/GLOBAL2014/headers/')
WHERE (PageAreaID = 162) and PageTopImage like '/Files/System/USA2010/images/header/%'

But it returns the follow:

The following message was returned by the server:

Incorrect syntax near '�'.

 
Mikkel Ricky
Reply

Make sure that you copy the sql expression as plain text. 

 
Andrew Mannell
Reply

Hi Mikkel,

THANK YOU!!!

Final code as the path in the databnak is from the folder.

update Page
set PageTopImage = replace(PageTopImage, 'USA2010/images/header/' , '../Billeder/GLOBAL2014/headers/')
WHERE     (PageAreaID = 162) and PageTopImage like 'USA2010/images/header/%'

Andy

 

 

 

You must be logged in to post in the forum