Posts

Getting the metadata descriptions of a page via macro expression

If you have defined the descriptions to pages and if any page inherits page descriptions form its parent, the macro would return null. Pleas use following macros instead:
{% DocumentContext.CurrentDescription %} If you have defined the descriptions to pages and if any page not inherits page descriptions form its parent. Pleas use following macros instead:
{% CurrentDocument.DocumentPageDescription %}

Conut document have children that are show in navigation

if(Documents[CurrentDocument.NodeAliasPath].Children.WithAllData.Where("ClassName = 'cms.menuitem' AND DocumentMenuItemHideInNavigation = 0").Count > 0) { true } else { false } OR if(Documents[NodeAliasPath].Children.Where("ClassName = 'CMS.MenuItem' AND DocumentMenuItemHideInNavigation = 0").Count > 0) { true } else { false }

Custom OpenCart 2.3.0.2 theme

Image
I was looking to customize the default theme in OpenCart 2.3.0.2 and realized that I will probably need to do quite a bit of work given there was no immediate “help” related on the subject. In essence it turned out to be a lot less painful than I thought. Here is what I did. Assuming new theme name “mytheme” and title “My Theme”. Make copies… To start with copy the default folder found inupload/catalog/view/theme/default to a new folder in the same directory. Name it “mytheme“. Then copy the theme_default.php file inupload/admin/controller/extension/theme and place it in same directory. Name it “mytheme.php“. + Rename the class to (line 2): ControllerExtensionThemeMyTheme + Replace all “theme_default” text to “mytheme“. Yes there are a lot (197). Copy the theme_default.tpl inupload/admin/view/template/extension/theme and place it in the same directory. Name it “mytheme.tpl“. + Replace all “theme_default” text to “mytheme“. (48) Copy theme_default.php inupload/admin/language/en-gb/extensio…

PHP: Replace space in front of capitals in a string (Regex)

I have a number of strings which contain words which are bunched together and I need to seperate them up.

For example ThisWasCool - This Was Cool MyHomeIsHere - My Home Is Here

$String = 'TheCambodia'; $Words = preg_replace('/(?<!\ )[A-Z]/', ' $0', $String); echo $Words;

Output: The Cambodia

How to display image from "image selection" field in transformation

Image
You can use following sample code:





<img src="<%# GetDocumentUrl("Image", "") %>" />

Login failed for user 'IIS APPPOOL\DefaultAppPool'

Image
If you don't change, each app pool has it's own identity. In your case, just add a new user to your database SmallBakery with the name IIS APPPOOL\SmallBakery using SQL Management Studio. You find the users list in the "Security/Users" subnode of your database. This should look something like that:




For testing, let the user be member of the db_owner role. If that works, remove this role and just let it be member of db_datareader and db_datawriter.

This way, each app pool (perhaps each website, if they all use their own app pool) only has access to the corresponding database.

If you use Default Web Site so you add "IIS APPPOOL\DefaultAppPool"

SQL Server can't login with newly created user

Image
SQL Server was not configured to allow mixed authentication.

Here are steps to fix:

Right-click on SQL Server instance at root of Object Explorer, click on PropertiesSelect Security from the left pane.Select the SQL Server and Windows Authentication mode radio button, and click OK


Right-click on the SQL Server instance, select Restart (alternatively, open up Services and restart the SQL Server service).