This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Depends on Tridion Powershell Modules (http://code.google.com/p/tridion-powershell-modules/) | |
| function createPublication { | |
| Param( | |
| [parameter(Mandatory=$true)] | |
| [ValidateNotNullOrEmpty()] | |
| $core, | |
| [parameter(Mandatory=$true)] | |
| [ValidateNotNullOrEmpty()] | |
| [string]$title, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [TcmTemplateTitle("SuffixBinariesWithId")] | |
| public class SuffixBinariesWithId: ITemplate | |
| { | |
| public void Transform(Engine engine, Package package) | |
| { | |
| string paramMimeTypesToMatch = package.GetValue("mimeTypesToMatch"); | |
| // match all image types by default | |
| string mimeTypesToMatch = "image/*"; | |
| if (!string.IsNullOrWhiteSpace(paramMimeTypesToMatch)) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // componentUri is a TcmUri representing the id of the binary component that you want to publish | |
| // This snippet shows how you can add the item id to the filename. | |
| var component = (Component)engine.GetObject(componentUri); | |
| var filename = component.BinaryContent.Filename | |
| extension = Path.GetExtension(filename); | |
| filename = Path.GetFileNameWithoutExtension(filename); | |
| filename = String.Concat(filename, "_", componentUri.ItemId.ToString(), extension); | |
| engine.AddBinary(component.Id, null, null, component.BinaryContent.GetByteArray(), filename); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $params = @{ | |
| client_id='cduser' | |
| client_secret='CDUserP@ssw0rd' | |
| grant_type='client_credentials' | |
| resources='/' | |
| } | |
| $token = Invoke-RestMethod -Uri 'http://localhost:9082/token.svc' -Method POST -Body $params | |
| $Authorization = $token.token_type + ' ' + $token.access_token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ComponentPresentations] | |
| public List<IRenderableViewModel> ComponentPresentations { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @foreach (var cp in Model.ComponentPresentations.Where(cp => cp.RenderData.View == "ContentBlock")) | |
| { | |
| @Html.Render(cp) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public List<IRenderableViewModel> ContentBlocks { | |
| get | |
| { | |
| return ComponentPresentations | |
| .Where(cp => cp.RenderData.View == "ContentBlock") | |
| .ToList<IRenderableViewModel>(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @foreach (var cp in Model.ContentBlocks) | |
| { | |
| @Html.Render(cp) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [PresentationsByView(ViewPrefix ="ContentBlock")] | |
| public List<IRenderableViewModel> ContentBlocks { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Setup | |
| $publicationId = 20 # The publication where your content is published | |
| # Broker database - substitute your own settings here. | |
| $connStringBuilder = new-object System.Data.SqlClient.SqlConnectionStringBuilder | |
| $connStringBuilder["Data Source"] = "WEB8,1433" | |
| $connStringBuilder["Initial Catalog"] = "Tridion_Broker" | |
| $connStringBuilder["User ID"] = "TridionBrokerUser" | |
| $connStringBuilder["Password"] = "Tridion1" |