Skip to main content

Posts

Showing posts from June, 2007

Handling / Resizing Multiple / Single Image Uploads

Upload.asp gets called everytime someone uploads somthing into an input template. For a single image upload we can do the following inside the input.asp: <tr> <td>Image</td> <td> <span name="pic_span" id="pic_span"> <% if content.item("image_name") <> "" then %> <img src="<%= content.item("image_name") %>" /> <% end if %> </span> <% input.setParam "span_label", "pic_span" %> <% input.setParam "show_browse", "link" %> <% input.setParam "show_upload", "attatch" %> <% input.showAcquireImage "image_name", content.item("image_name") %> </td> </tr> If there are multiple images change the above so that all content.items becomes the list object. When createing the list use the image_name as th

Creating Multiple Files From a Single Template

Sometimes you need to create multiple files from a single template. For instance, when you have a drop down list that displays certain items depending on what is selected, the CMS handles this by creating multiple files (i.e. different versions of the same page populated with different static content). Since the content is managed by the CMS it would be redundant to have the same information hosted on the clients database server and also the CMS is not capable of generating dynamic pages that pull information from the CMS database itself. I believe the CMS database is closed off to external programs / scripts. So moving along, you create multiple Files by using the filename.asp template file. At this moment I am uncertain how many times or what events trigger the code in the filename.asp to fire. I am aware that you can create a file for every link in the template. One of the things that seems to link the output.asp file and filename.asp is the use of asset.setParam "args"

The Storage of Content / Uploads Within the CMS

Prior to publishing out an asset to either a live site or a stage site, assets store information within a database or on CrownPeak's local web server. Essentially, an asset only holds Key / Value pairs within the database and any documents or images that were uploaded from an input form gets stored on the CrownPeak's local web server (i.e. A0 - A8). Usually the keys are user defined within the input template and can be viewed by selecting an asset and going to View -> Properties -> Content. Viewing the content, there are several things that probably should be pointed out. Upload#user_defined_name:1 is probably a key in the database. The word Upload in the key specifies that the value for this key is probably a location to CrownPeaks local web server (i.e. the path to where the upload is stored.) When an upload is published out it gets copied from the local web server to the clients server.

Creating an Asset via Email i.e. SMTP Import

In order to create an SMTP Import, you first need to configure it within the CMS. Goto: System -> Configure -> Import -> SMTP Create the import: File -> New Email Import Set it up with these settings: Document User = CrownPeak Admin Folder = Folder to create the asset in. Model = Model that will be used to create the asset Send Errors = Specifies what to do if errors occur. It will give you a token that you need to use in the subject line of your email. It is also possible to use it in the body of the email but I have never tried it. Seems the subject line is more suited for this. Next you need to setup the smtp_import.asp template file: If this asset doesn't depend on the input being recieved, then you can just execute the following a couple of times to populate the asset: content.add "fieldname", "value" However if the asset does depend on the input being recieved perhaps to create an asset in a certain directory depending on the input, you can sto

Changing The Default Publishing Path

To change the default publishing path i.e. the location on the live server that an asset gets published to, do this. In the asset's template first add this: filename.asp Then add this line in the file: content.add "_cmsPublishPath", "/directory0/directory1/"

Asp.Net C# Sending Email

This entry will describe how to send email using Asp.Net and C#. There will be a couple examples maybe jumbled together, but it will cover these topics: 1. Sending Text Email 2. Sending HTML Email 3. Sending Attatchments First off, specify/import the library you need... Using System.Net.Mail; (CodeBehind) or <@ Import Namespace="System.Net.Mail" > (Inline) Next create the mail object.... MailMessage mail = new MailMessage(); Then set the mail object fields... (Your usual... To, From, Subject, Body) mail.From = new MailAddress("someone@gmail.com"); mail.To.Add("someone@gmail.com"); mail.Bcc.Add("someone@gmail.com"); mail.Subject = "The Subject Line"; mail.Body = "The Body String"; For HTML email setting a single field will do... mail.IsBodyHtml = true; If you want to add attatchments, do the following... the first argument is a stream and the second is a string for the filename. mail.Attatchments.Add(new Attatchment(FileU