PDA

View Full Version : view-Link.tpl how to customise?


Loren
05-12-2006, 10:27 PM
Has anyone customized their own view-link?

I want to customize mine so i can put certain fields i have created in certain places at the side of the pages.

Basically at the moment some of the default field links are rearrangeable, but the ones i want to move are my custom links but they are all block encoded, and unseparatable. Can anyone tell what codes i would use to separate customed link fields instead of the block coding?

Loren
05-15-2006, 10:38 AM
In good ol' redeye fashion *bump* :D

WTM
05-16-2006, 01:52 AM
Could you please post an example of "block code" you are trying to separate?

Also maybe image of what do you want to accomplish...

redeye
05-16-2006, 06:48 AM
In good ol' redeye fashion *bump* :D

"Bump" is the sole copyright of ....... :P

Loren
05-16-2006, 08:01 AM
Could you please post an example of "block code" you are trying to separate?

Also maybe image of what do you want to accomplish...

Thank You WTM for taking some interest in this but to be honest, its not the design i have problems with its separating the view link block code. Ie all custom fields get blocked under one code. And i want to know how to write them individually, so i can place them in different parts of the page.

the names of fields displayed.
{$lang.$key}:

The coding for the fields.
{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} {$link.$key} {/if} {/if} {/if} {else} {$lang.not_available} {/if} {/if} {/foreach}

is what i have at the moment, and basically that includes all that i have created. My fields, are logo, qualifications, memberships, ailments_treated, events, courses etc. For example i want to place them in 3 columns layout, events goes down the left side, main bulk of fields in the middle and courses on the right hand side. I have prepared the new header and footer, so now all i need to know is how to achieve separating the codes individually :)

:offtopic:
>>>For Redeye<<<
"Bump" is the sole copyright of ....... Tongue Awwww, can't you share it with a fellow Brit :cry:

Nick Collins
05-16-2006, 10:26 AM
Hi Loren and sorry for delay with answer. It’s easy to achieve your goal. You only need to know html. Here is a solution:
***open view-link.tpl***
***comment or delete the following code***
{foreach from=$fields item=field}
bla bla bla
{/foreach}
Now you can start to display each field step by step. For example:
<tr>
<td>Link URL:</td><td colspan="2">{$link.url}</td>
</tr>

<tr>
<td>{$lang.description}:</td><td colspan="2" style="border: 1px solid #333;">{$link.description}</td>
</tr>

<tr>
<td>Custom Field:</td><td colspan="2">{$link.custom_field_name}</td>
</tr>
How you can see it’s possible to display these fields in your own way (it’s not necessary to display them in the table). Of course you should replace “custom_field_name” with the real name of your field (you can find it in the language file in case you forgot it). Hope my example will help you ;)

Loren
05-16-2006, 10:32 AM
Thanks Nick will have a fiddle with this new info :good:

Greg
05-16-2006, 02:41 PM
Hope that works Nick. :) I tried to figure out how to do that since the last version.
It's those "foreach" thingies that always throw me off. :huh:

Nick Collins
05-18-2006, 04:06 AM
It works 100%, Greg. I tested it myself! Do you agree with me, Loren?

Loren
05-18-2006, 05:24 AM
Don't know as yet Petal, but soon as i have got around to that task i will let you know :good:

Nick Collins
05-18-2006, 05:28 AM
It's all arranged! ;)

Loren
05-26-2006, 07:17 AM
It's all arranged! ;)
Have no idea what you meant by that Nick

But just to follow on from this, yes it does work. I have managed to customise my view-link page to how i want it however i have one huge major problem.:(

Remember the Mod to stop fields being displayed if not filled in? Well this worked like a dream on my old view-link page, but now it doesn't work at all in my new page, even if i leave the code in there. Like this:

<!-- start of link fields display -->
{foreach from=$fields item=field}
{assign var="key" value=$field.name}
{assign var="show" value='1'}
{if 'logo' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'qualifications' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'memberships' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'ailments_treated' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'services_offered' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'courses_offered' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'events' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'county' == $key && ('Select County' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'location' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'contact' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'country' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'telephone' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if 'email_display' == $key && ('' == $link.$key || '' == $link.$key)}{assign var="show" value='0'}{/if}
{if '1' == $show}{/if}
{/foreach}
How can i rectify this please? I still wish to have this feature

WTM
05-26-2006, 07:51 AM
Loren,

Why don't you try this:{if $link.your_custom_field neq ''}
<tr>
<td><strong>{$lang.your_custom_field}:</strong></td>
<td>{$link.your_custom_field}</td>
</tr>
{/if}

I think it should do the trick...
Let me know if it's working

Loren
05-26-2006, 08:08 AM
Hi WTM

Thank you for your reply :) I am presuming i would do that for each custom field, is this correct?

Loren
05-26-2006, 08:13 AM
Okay no need to answer this, yes is the answer, and it works perfectly...bless you, you are a good soul

Nick Collins
05-26-2006, 08:23 AM
I have just deleted the same solution as WTM posted. There is nothing impossible with eSyndiCat, Loren, as you can see ;)

Loren
05-26-2006, 08:58 AM
I never believed otherwise :) and often stated it myself to others...therefore on that note can you find the solution to my other question i posted this am about the sponsored and the featured being different? I will be then finished with my questions...

Nick Collins
05-26-2006, 09:51 AM
I do my best, Loren! Let's go to that thread.

Greg
05-26-2006, 03:45 PM
It works 100%, Greg. I tested it myself! Do you agree with me, Loren?

Perfect Nick. :good: So easy now to create a "custom" look to the details page.
Thanks :)

Cris Santos
05-31-2006, 06:03 PM
I followed Nicks/Loren's tips above to customize my view-links.tpl page, but now they results show up 4 times each...view here http://www.the-c-channel.com/directory/view-link.php?id=4

Plus I want the "url" field to show up with live link so that i can take the link off the title.
Please help.

Greg
05-31-2006, 09:39 PM
I followed Nicks/Loren's tips above to customize my view-links.tpl page, but now they results show up 4 times each...view here http://www.the-c-channel.com/directory/view-link.php?id=4

Cris Post your view-link.tpl code and one of us may see the problem.

Nick Collins
06-01-2006, 09:04 AM
I have just fixed Cristina's problem. Here is a code she had:
<!-- start of link fields display -->
{foreach from=$fields item=field}
{assign var="key" value=$field.name}
{assign var="show" value='1'}




{if $link.Logo neq ''}<tr><td><strong>{$lang.Logo}:</strong></td><td>{$link.Logo}</td></tr>{/if}

{if $link.title neq ''}<tr><td><strong>{$lang.title}:</strong></td><td>{$link.title}</td></tr>{/if}

{if $link.description neq ''}<tr><td><strong>{$lang.description}:</strong></td><td>{$link.description}</td></tr>{/if}

{if $link.url neq ''}<tr><td><strong>{$lang.url}:</strong></td><td>{$link.url}</td></tr>{/if}
{if '1' == $show}{/if}
{/foreach}
<!-- end of link fields display -->

Loren
06-01-2006, 11:48 AM
Was it the foreach left in, that was causing the duplication?

Cris Santos
06-01-2006, 06:08 PM
It seems it was.
As soon as it was taken out voila, all pretty again - thanks Nick.

Nick Collins
06-15-2006, 05:32 AM
It seems it was.
As soon as it was taken out voila, all pretty again - thanks Nick.

You are welcome, Cris!

Greg
12-11-2006, 08:14 PM
Will this same mod work with Pro v2.x ?

Greg
12-12-2006, 08:27 PM
bump :blink:

Simon Gooffin
12-13-2006, 05:39 AM
Hi Greg,
Please check this thread. I think it is very close to this one:
http://www.esyndicat.com/forum/about6384.html