Stephen Young
08-05-2006, 09:46 PM
Hi All
Just having a play around with the script, what I needed was to change text shown for certain links. Ie to show http://www.domain.com/product_name instead of http://www.domain.com/cat/display?product_id=1234
I created an extra admin only field 'display_url' not shown by default on any page which defaults to 'null' when entering a link unless I decide that the link text should change and enter a more friendly url
Just a question, from what I see it seems to work fine although will this cause me any problems in the future? and does this need changing elsewhere?
Changes were:
In link-display.tpl
<div class="url">
{if $link.display_url}
{$link.display_url}
{else}
{$link.url}
{/if}
</div>
In view-link.tpl
{foreach from=$fields item=field}
{assign var="key" value=$field.name}
<tr>
<td><strong>{$lang.$key}:</strong></td>
<td>
{if $link.$key}
{if $field.type eq 'textarea' AND $config.esc_codes}
{text_to_html aText=$link.$key aParagraph=true}
{elseif $field.type eq 'checkbox'}
{array_to_lang values=$link.$key}
{else}
{if ($link.$key eq $field.default) AND (($field.type neq 'textarea') AND ($field.type neq 'text'))}
{assign var="lang_key" value=$field.default}
{$lang.$lang_key}
{else}
{if ($field.type neq 'textarea') AND ($field.type neq 'text')}
{assign var="lang_key" value=$link.$key}
{$lang.$lang_key}
{else}
{if ($key eq url) AND ($link.display_url)}
{$link.display_url}
{else}
{$link.$key}
{/if}
{/if}
{/if}
{/if}
{else}
{$lang.not_available}
{/if}
</td>
</tr>
{/foreach}
Just having a play around with the script, what I needed was to change text shown for certain links. Ie to show http://www.domain.com/product_name instead of http://www.domain.com/cat/display?product_id=1234
I created an extra admin only field 'display_url' not shown by default on any page which defaults to 'null' when entering a link unless I decide that the link text should change and enter a more friendly url
Just a question, from what I see it seems to work fine although will this cause me any problems in the future? and does this need changing elsewhere?
Changes were:
In link-display.tpl
<div class="url">
{if $link.display_url}
{$link.display_url}
{else}
{$link.url}
{/if}
</div>
In view-link.tpl
{foreach from=$fields item=field}
{assign var="key" value=$field.name}
<tr>
<td><strong>{$lang.$key}:</strong></td>
<td>
{if $link.$key}
{if $field.type eq 'textarea' AND $config.esc_codes}
{text_to_html aText=$link.$key aParagraph=true}
{elseif $field.type eq 'checkbox'}
{array_to_lang values=$link.$key}
{else}
{if ($link.$key eq $field.default) AND (($field.type neq 'textarea') AND ($field.type neq 'text'))}
{assign var="lang_key" value=$field.default}
{$lang.$lang_key}
{else}
{if ($field.type neq 'textarea') AND ($field.type neq 'text')}
{assign var="lang_key" value=$link.$key}
{$lang.$lang_key}
{else}
{if ($key eq url) AND ($link.display_url)}
{$link.display_url}
{else}
{$link.$key}
{/if}
{/if}
{/if}
{/if}
{else}
{$lang.not_available}
{/if}
</td>
</tr>
{/foreach}