« Earlier 19 items total Later »

On this page: 

Linking to Stylesheets

http://eedocs.pmachine.com/templates/globals/stylesheet.html

<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=static/style}" />

<link media="screen" type="text/css" href="{stylesheet=static/style}" />


Snippets Plugin

Coding to use for the Expression Engine Snippets Plugin:

In the actual pages:
{exp:snippets template="static/index"}
{page_title}Site: {title}{/page_title}
{page_section}journal{/page_section}
{/exp:snippets}


In the header include (static/index in this case):
%page_title%
%page_section%
<?
$fof_title="%nl_title%";
$fof_section="%nl_section%";
?>


Define them as variables in PHP for easy if/else statements. :)

Total Number of Entries for one Weblog

{exp:stats weblog="weblog1"}{total_entries}{/exp:stats}

Entry Date

{entry_date format="%F %d, %Y"}
{edit_date format="%F %d, %Y"}


More formatting options:
http://eedocs.pmachine.com/templates/weblog/variables.html#date_variables
http://eedocs.pmachine.com/templates/date_variable_formatting.html

Display In 2-Column Table

The below can be applied to MT, EE, etc, and will display the content in a 2 column table. The EE tags below are just an example, it will work equally well if you replace it with MT, Wordpress, etc, tags.

<? $set_table="0"; ?>

<table cellpadding="5" border="0">
{exp:gallery:categories gallery="{gallery_name}"}
<? 
$fs_table = $set_table +1;
if ($set_table == "1") {echo"<tr>";} ?>


Insert other tags here.


<? if ($set_table == "2") {echo"</tr>";  $set_table="0";} ?>
{/exp:gallery:categories}
</table>

Use PHP Inside EE Entries

You'll need the following plugins:
Allow EE Code: http://www.pmachine.com/plugins/allow-eecode/
Allow PHP: http://loweblog.com/archive/2005/06/03/ee-allow-php-plugin/

Set text formatting for the field you want to use this on to "None" (Admin > Weblog Administration > Custom Weblog Fields).

Change your template by adding the Allow EE tags around the field:

{exp:allow_eecode}{body}{/exp:allow_eecode}


Now you can use PHP inside your entries like this:

<p>Bla bla regular entry text</p>

{exp:allowphp}
echo "This will be processed as PHP.";
{/exp:allowphp}

CSS Switcher Code

{exp:css_switcher}<link rel='stylesheet' type='text/css' media='all' href='{file}' />{/exp:css_switcher}


<form action="<?php echo $_SERVER ['REQUEST_URI']; ?>" method="post">
<select name="css_skin" id="css_skin">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select><input type="submit" value="Set New Skin" />
</form>
<ul>
<li><a href="<?php echo $_SERVER ['REQUEST_URI']; ?>?css_skin=1">1</a></li>
<li><a href="<?php echo $_SERVER ['REQUEST_URI']; ?>?css_skin=2">2</a></li>
</ul>


Code for using the CSS Switcher plugin. Insert this anywhere in a EE template where you want this to show.

Edit Link In An Entry

Without the Snippets plugin (ie, straight on the template itself):

{if member_group == "1"}
<a href="/system/index.php?C=edit&M=edit_entry&weblog_id={weblog_id}&entry_id={entry_id}" title="Edit Entry">Edit This</a>
{/if}


With the Snippets plugin (ie, included in a seperate template that gets pulled into all other templates):

{if member_group == "1"}
<a href="/system/index.php?C=edit&M=edit_entry&weblog_id=%editweblog%&entry_id=%editweblog2%" title="Edit Entry">Edit This</a>
{/if}


And use this to include the editlink template:

{exp:snippets template="static/editlink"}
{editweblog}{weblog_id}{/editweblog}
{editweblog2}{entry_id}{/editweblog2}
{/exp:snippets}

Number of Entries in Galleries

All Galleries:
{exp:query sql="SELECT count(entry_id) AS count FROM exp_gallery_entries"}{count}{/exp:query}


One specific Gallery:
{exp:query sql="SELECT count(entry_id) AS count FROM exp_gallery_entries WHERE gallery_id=1"}{count}{/exp:query}

List of Stats

{exp:stats weblog="not 1|2"}
<ul>
<li>Since 2001, I have posted <strong>{total_entries}</strong> entries,</li>
<li>and received <strong>{total_comments}</strong> comments.</li>
<li><strong>{total_guests}</strong> people are currently browsing the site,</li>
<li>the most people online at the same time was <strong>{most_visitors}</strong> on <strong>{most_visitor_date format="%M %d, %y"}</strong>.</li>
</ul>
{/exp:stats}

« Earlier 19 items total Later »