- - -
-

CityDesk

Back to home

Jump to:


Including a file in the local directory

The include command lets you include a specific article into the current article. It is a fix article for all uses. include of a single file. However, with the following code you can include a file from the current directory, and the code can be used in a template:

{$foreach 1x in (and (thisFolder) (fileName "sidebar"))$}
{$x.body$}
{$next$}

You can also put the code into a variable, which keeps templates cleaner and makes changing things easier.

[31-Mar-07]


FTP stops working

Problem: All of a sudden, FTP stops working, but only in CityDesk. Other FTP clients on the same PC work fine. The error message you get in CityDesk is:

Couldn't connect to FTP server: The computer is disconnected from the network.

Solution: If Internet Explorer (or Outlook Express) is set to 'Work Offline' then effectively so is CityDesk as well. This is true even if you don't have IE open. Hence solution is to open IE and go back online. CityDesk will then work.

 

[6-Nov-05]


Number of articles

Here's code from the forum that displays the number of articles:

<script language="javascript" type="text/javascript">
//<![CDATA[
<!--
var tmp = "{$ foreach x in (all) $}.{$ next $}";
if (tmp.length==0)
{
document.write(" currently no articles on this site.<br>");
} else
{
document.write("currently ",tmp.length," articles on this site.<br>");
}
//-->//]]>
</script>

[27-Jan-04]


Code to insert an MPG movie

Here's code to insert an MPG movie:

Some important notes:

  • Don't switch to Normal mode - it will break the code
  • The height and width values should be the size of your movie. You can get these numbers in Windows Media Player via File > Properties.
  • Add 45 pixels to the height value for the control bar, otherwise your movie will be squished.

<div id="Content">
<object ID="WinMedia"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
CODEBASE= "http://activex.microsoft.com/activex/
controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
width=225 height=260 standby="Loading Microsoft
Windows Media Player components..." type="application
/x-oleobject">

<PARAM NAME="FileName" VALUE="../Images/wg_gdo_1.mpg" />
<PARAM NAME="AutoStart" Value="false" />
<PARAM NAME="ShowControls" Value="true" />

<Embed type="application/x-mplayer2"
pluginspage= "http://www.microsoft.com/Windows/MediaPlayer/"
src="../Images/wg_gdo_1.mpg"
Name="MediaPlayer"
AutoStart=0
Width=225
Height=260
ShowControls=1 >
</embed>
</object>
</div>

This came from http://columbuswebmakers.com/Workbench/mpgtest.html and from http://discuss.fogcreek.com/CityDesk/default.asp?cmd=show&ixPost=9663&ixReplies=9 [24-Dec-03]


Keywords are not case sensitive

The keyword (HOME) and (home) are treated as the same. [16-Dec-03]


Equivalent of an IF statement

Read it on the forum. Tried it and it works.

{$ forEach x in (and(thisArticle)(keywordContains "homepage")) $}
    the bits that I want to show
{$ next $}

The text inside the forEach loop is only processes if the article has keyword homepage.

[16-Dec-03]


Using subarticles

There are times when you want to form an article using lots of "subarticles", that is,articles that are snippets of text which you import using a For loop or an Include script command.

For example, the code to geneate this page is the following (assuming the index file is in the same directory):

<p>{$ forEach x in (and(thisFolder)(not(thisArticle))) sortDescendBy .modifiedDate $}</p>
<hr />
<h2>{$ x.headline $}</h2>
<p>{$ x.body $}<p>
<p>{$next$}</p>

The advantage of using subarticles and a For loop is that individual subarticles can expire and the parent article will still display correctly, just without that expired subarticle.

The only trick is: how do you prevent the subarticles themselves from being published. The solution is to create a blank template:

  1. Open the Templates window
  2. Click New Template to create a new template, name it Blank
  3. Delete the text {$.body$} from the Article window
  4. Click Save and Close.

Now set the template style for each subarticle to be blank. That's it. Now those subarticles won't be published, but can still be used when referring to by other articles.

One extra step: the articles that use the blank template won't be published, but they will still be picked up via a forEach loop (eg you may have a loop showing the articles published in the last 7 days). So you'll need to add a condition based one of the fields (eg a blank author line or a specific keyword) to ensure they aren't picked up that way.

[28-Nov-03]


Intra-article shortcuts

If you have a Web page with many headings (such as this one), you may want to put a shortcut list at the top of the page so readers can jump to the page. [15-Sep-03]


Different stylesheets for some pages

Is the secret to having one stylesheet for the entire Web site, but having text only appear on the main page:

  • Use the include statement
  • Use an extra local stylesheet and override with a display:none
[9-Sep-03]


Using a style sheet

The easiest way to use a style sheet in CityDesk is as follows:

  1. Create a file using New HTML, renaming the .html file to .css
  2. Copy the magic name to the clipboard by right-clicking the css file and clicking Copy Magic Name
  3. In the <head> section of your template (probably either in your template or in a variable), add the following line:

    <head>
    <link type="text/css" rel="stylesheet" href="PTMFOG000017.css">
    </head>

  4. Modify the href parameter by pasting in the magic name from step 2.

You can then add your CSS code to the .css file and it will be used throughout your Web site. [7-Sep-03]


Sites I want to remember

These are the Web sites that I want to remember for reasons such as layout or CSS usage, etc

[7-Sep-03]

-
- - -
Made with CityDesk!
Last update: 3 January 2008
Brain owner: David Watts