Skip to content

Instantly share code, notes, and snippets.

@jhorsman
jhorsman / Post-build event command line
Created January 17, 2014 09:54
Restart Tridion services in Visual Studion pre-build and post-build events. See https://gist.github.com/jhorsman/6931759 for PowerShell scripts. Run the post-build event always to start services after a failed build.
powershell -file "$(SolutionDir)tools\Tridion-services-start.ps1"
@jhorsman
jhorsman / publish-a-page.ps1
Last active January 4, 2016 19:39
Publish a SDL Tridion page trhough PowerShell. Prerequisites: http://code.google.com/p/tridion-powershell-modules/ and any Tridion 2011+ server.
# Set up a Tridion Core Service client for the Content Manager server cms.server.com.
# The 2013-SP1 label is for the CM server version, other valid entries are 2011-SP1 and 2013.
Import-Module Tridion-CoreService
Set-TridionCoreServiceSettings cms.server.com 2013-SP1
$client = Get-TridionCoreServiceClient
# Set a publish instruction with resolve instruction and render instruction. These are all standard
# instructions, nothing special here but you can use this to create a special publinshing action.
$publishIntructionData = New-Object Tridion.ContentManager.CoreService.Client.PublishInstructionData
$publishIntructionData.RenderInstruction = New-Object Tridion.ContentManager.CoreService.Client.RenderInstructionData
<!-- TemplateBeginRepeat name="Component.Fields.repeatField" -->
<!-- TemplateBeginIf cond = "TemplateRepeatIndex == 0 " -->
<ul>
<!-- TemplateEndIf -->
<li>@@Field@@</li>
<!-- TemplateBeginIf cond = "TemplateRepeatIndex) == @@CollectionLength("repeatField")@@-1" -->
</ul>
<!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
@jhorsman
jhorsman / createTridionUser.cs
Last active September 14, 2015 12:16
Create an SDL Tridion user trhough CoreService. Assumes having the Tridion Core Service Client DLL config as app.config
using System;
using System.ServiceModel;
using Tridion.ContentManager.CoreService.Client;
namespace CoreServiceSandbox
{
internal class Program
{
private static void Main(string[] args)
{
@jhorsman
jhorsman / SmartTargetTags-2011.aspx
Created April 10, 2014 15:16
SmartTarget tags example for SmartTarget 2011
<!-- Start Promotion Region: {"RegionID": "HomepageBanners" } -->
<smarttarget:Query View="home" Publication="tcm:0-69-1" runat="server" SiteEditTagName="span">
<smarttarget:Facet Category="tcm:69-707-4" runat="server"></smarttarget:Facet>
<smarttarget:Promotions MaxItems="1" Region="HomepageBanners" runat="server">
<ItemTemplate>
<smarttarget:PromotionalItems runat="server">
<ItemTemplate>
<span>
<!-- Start Promotion: { "PromotionID": "<%# Eval("promotionID") %>", "RegionID" : "<%# Eval("region") %>"} -->
@jhorsman
jhorsman / promotions.jsp
Created May 2, 2014 06:59
SDL SmartTarget promotions on JSP
<smarttarget:query view="home" publication="tcm:0-71-1">
<smarttarget:facet category="tcm:69-707-4"></smarttarget:facet>
<smarttarget:promotions maxItems="3" var="promotion" region="homepagepromotions"> <!-- HomepageBanners -->
<smarttarget:itemTemplate>
<smarttarget:promotionalItems>
<smarttarget:itemTemplate>
<tridion:ComponentPresentation pageURI="tcm:69-6212-64" componentURI="${item.componentUri}" templateURI="${item.templateUri}"/>
</smarttarget:itemTemplate>
</smarttarget:promotionalItems>
</smarttarget:itemTemplate>
@jhorsman
jhorsman / SDL Tridion versions
Last active May 29, 2020 08:47
SDL Tridion versions and release dates
Release 1 (1996)
Release 2 (1997)
Release 3 (1999)
Release 4 (2001)
Release 5 (2003)
Tridion 5.1 (2005)
Tridion 5.2 (2006)
SDL Tridion 5.3 (January 2008)
SDL Tridion 2009 (November 2009)
SDL Tridion 2011 (Januari 2011)
@jhorsman
jhorsman / SmartTarget_tag_demo.aspx
Last active August 29, 2015 14:01
SDL SmartTarget tag demo of variables in the promtion query in a SDL SmartTarget enabled page. This is ASPX code. See https://gist.github.com/jhorsman/8363387 for the JSP version.
<%@ Page Title="SDL SmartTarget tag demo" Language="C#" %>
<%@ Register Assembly="Tridion.SmartTarget" Namespace="Tridion.SmartTarget.Web.UI" TagPrefix="smarttarget" %>
<%@ Import Namespace="System.Web" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>SmartTarget tag demo</title>
</head>
<body>
PowerShell.exe -ExecutionPolicy RemoteSigned -Command "& {.\Add-AssemblyToGlobalAssemblyCache.ps1 -AssemblyName C:\Temp\MyWorkflow.dll }"
@jhorsman
jhorsman / start-Fredhopper.bat
Created May 13, 2014 06:55
Start SDL Fredhopper. A handy (Windows only) development tool when using SDL SmartTarget 2014. On a production server the Fredhopper processes would be started by a Scheduled Task on start of the server. Run start-Fredhopper.bat to get things going.
@echo off
start start-deployment-agent.bat
echo Launched deployment agent in separate window
echo.
echo Pausing before starting the instance
timeout 60
echo.
start start-instance.bat