Limit characters on <xen:h1>

Dad.

Well-known member
Hey all, is there any way I can limit the character count with XenForo? I can do it with Javascript but its kinda a hassle in case their is an easy function.

Thanks,
Mike
 
Admin CP -> Appearance -> Templates -> PAGE_CONTAINER

Replace the red code:

Rich (BB code):
						<xen:hook name="page_container_content_title_bar">
						<xen:if is="!{$noH1}">						
							<!-- h1 title, description -->
							<div class="titleBar">
								{xen:raw $beforeH1}
								<h1><xen:if
									is="{$h1}">{xen:raw $h1}<xen:elseif
									is="{$title}" />{xen:raw $title}<xen:else
									/>{$xenOptions.boardTitle}</xen:if></h1>
								
								<xen:if is="{$pageDescription.content}"><p id="pageDescription" class="muted {$pageDescription.class}">{xen:raw $pageDescription.content}</p></xen:if>
							</div>
						</xen:if>
						</xen:hook>

Like so:

Rich (BB code):
						<xen:hook name="page_container_content_title_bar">
						<xen:if is="!{$noH1}">						
							<!-- h1 title, description -->
							<div class="titleBar">
								{xen:raw $beforeH1}
								<h1><xen:if
									is="{$h1}">{xen:helper wordtrim, {xen:raw $h1}, 6}<xen:elseif
									is="{$title}" />{xen:raw $title}<xen:else
									/>{$xenOptions.boardTitle}</xen:if></h1>
								
								<xen:if is="{$pageDescription.content}"><p id="pageDescription" class="muted {$pageDescription.class}">{xen:raw $pageDescription.content}</p></xen:if>
							</div>
						</xen:if>
						</xen:hook>

You can specify the number of characters.
 
Thanks Jake, and I know how to do this in PHP, just not really comfortable with the XenForo template helpers yet. But how would I add an ellipsis if the content was cut off?
 
Top Bottom