The freetag plugin has a tpl for displaying in the sidebar. Is there something like that available when in entry view?
I want to eliminate the text "Defined tags for this entry"... I also want to use a different html element to display the tag names, which are emitted by the plugin simply as a series of links.
Modifying freetag output
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Modifying freetag output
=Don=
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: Modifying freetag output
I think yes, but probably not in the way a theme author would like it.
If I see and remember that correctly: When the extended_smarty option is enabled, the plugin does not emit any html for entries. It instead fills smarty variables (freetag.tags.tags) and lets the template of the theme handle the tag display. The relevant code is here: https://github.com/s9y/additional_plugi ... .php#L1402
So you should be able to design this as you want in entries.inc.tpl, but users would only see it if they enable that option.
If I see and remember that correctly: When the extended_smarty option is enabled, the plugin does not emit any html for entries. It instead fills smarty variables (freetag.tags.tags) and lets the template of the theme handle the tag display. The relevant code is here: https://github.com/s9y/additional_plugi ... .php#L1402
So you should be able to design this as you want in entries.inc.tpl, but users would only see it if they enable that option.
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: Modifying freetag output
Sweet. Not exactly what I was looking for, but I think I can make something work with that. Thanks!
=Don=
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: Modifying freetag output
I finally had a chance to test this.
Should anyone modify this plugin in the future, I would love the ability to retrieve the tagname, and tag url individually, much like what works here with categories:
That's not completely true.... the value for each $tag is a full link <a href="tag_url">TAGNAME</a> which is html. True, there are no containers, nor anything else.onli wrote:When the extended_smarty option is enabled, the plugin does not emit any html for entries.
Should anyone modify this plugin in the future, I would love the ability to retrieve the tagname, and tag url individually, much like what works here with categories:
Code: Select all
{foreach from=$entry.categories item="entry_category" name="categories"}
<a href="{$entry_category.category_link}">{$entry_category.category_name|escape}</a>{if not $smarty.foreach.categories.last}, {/if}
{/foreach}
=Don=
Re: Modifying freetag output
I just happened to do modify related links today the way you asked for. If you use extended smarty you can change the output as follows:
In serendipity_event_freetag.php in function getRelatedEntriesHtml():
vorher:
nachher:
In entries.tpl:
Hope, that helps.
In serendipity_event_freetag.php in function getRelatedEntriesHtml():
vorher:
Code: Select all
$return['entries'][] = '<a href="' . serendipity_archiveURL($entryid, $title) . '" title="' . htmlspecialchars($title) . '">' . htmlspecialchars($title) . '</a>';
Code: Select all
$return['entries'][]['url'] = serendipity_archiveURL($entryid, $title);
$return['entries'][]['title'] = htmlspecialchars($title);
Code: Select all
{if isset($entry.freetag.extended) && $entry.freetag.extended == 1}
{if $entry.freetag.tags.tags}
<div class="serendipity_freeTag">{$entry.freetag.tags.description}
{foreach from=$entry.freetag.tags.tags item="tag"}
{$tag}
{/foreach}
</div>
{if $is_single_entry or $is_preview}
{$entry.freetag.related.description}
<div class="serendipity_freeTag_related"> <!-- (oder ul) -->
{foreach from=$entry.freetag.related.entries item="link"}
<div class="grid4"> <!-- (oder li) -->
<a href="{$link.url}">{$link.title}</a>
</div>
{/foreach}
</div>
{/if}
{/if}
{else}
{$entry.freetag}
{/if}
----------
peggylon aka multikulinaria http://www.multikulinarisch.es
peggylon aka multikulinaria http://www.multikulinarisch.es
Re: Modifying freetag output
As I stated in the previous post I somewhat changed the freetag plugin's output in my system.
What I couldn't figure out though, was how to get first image's url from related entries' bodies as third parameter.
So far I'm able to retrieve the desired images' urls in function getRelatedEntries() by adding
to the query. But I don't know how to properly transfer them into getRelatedEntriesHtml().
What I'd like to do there:
I'd be glad, if someone could give me a hint. Thanks guys.
What I couldn't figure out though, was how to get first image's url from related entries' bodies as third parameter.
So far I'm able to retrieve the desired images' urls in function getRelatedEntries() by adding
Code: Select all
SUBSTRING_INDEX( SUBSTRING( body, LOCATE( '/uploads', e2.body )),'.jpg', 1 ) AS imgurl,
to the query. But I don't know how to properly transfer them into getRelatedEntriesHtml().
What I'd like to do there:
Code: Select all
$return['entries'][]['imgurl']
----------
peggylon aka multikulinaria http://www.multikulinarisch.es
peggylon aka multikulinaria http://www.multikulinarisch.es
Re: Modifying freetag output
I finally figured out how to display preview pictures with related entries links. If there is a general interest in that I could perhaps update the plugin, if I get help along the way. Am not familiar with the process.
In my version of the plugin I edited two lines of the function getRelatedEntries as follows:
and in function getRelatedEntries:
Finally in template entries.tpl:
In my version of the plugin I edited two lines of the function getRelatedEntries as follows:
Code: Select all
$q = "SELECT DISTINCT
e1.entryid,
e2.title,
SUBSTRING_INDEX( SUBSTRING( body, LOCATE( '/uploads', e2.body )),'.jpg', 1 ) AS img,
e2.timestamp
FROM {$serendipity['dbPrefix']}entrytags AS e1
LEFT JOIN {$serendipity['dbPrefix']}entries AS e2
ON e1.entryid = e2.id
WHERE e1.tag IN ('" . implode("', '", $tags) . "')
AND e1.entryid != " . (int)$postID . "
AND e2.isdraft = 'false'
" . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND e2.timestamp <= " . time() : '') . "
ORDER BY e2.timestamp DESC
LIMIT " . $this->get_config('show_related_count', 10);
$result = serendipity_db_query($q, false,'assoc');
Code: Select all
$i = 0;
foreach($entries AS $entry) {
$return['entries'][$i]['url'] = serendipity_archiveURL($entry['entryid'], $entry['title']);
$return['entries'][$i]['title'] = htmlspecialchars($entry['title']);
$return['entries'][$i]['img'] = $entry['img'];
$i++;
}
Code: Select all
{if isset($entry.freetag.extended) && $entry.freetag.extended == 1}
{if $entry.freetag.tags.tags}
....
{if $is_single_entry or $is_preview}
{$entry.freetag.related.description}
<div class="serendipity_freeTag_related">
{foreach from=$entry.freetag.related.entries item="link"}
<div class="grid4"> //floating containers
<a href="{$link.url}"><img src="{$link.img}.serendipityThumb.jpg"></a>
<a href="{$link.url}">{$link.title}</a>
</div>
{/foreach}
</div>
{/if}
{/if}
{else}
{$entry.freetag}
{/if}
----------
peggylon aka multikulinaria http://www.multikulinarisch.es
peggylon aka multikulinaria http://www.multikulinarisch.es
Re: Modifying freetag output
Hey, great you solved that for yourself!
About using this for an official update, we should play with and find out, what it does and what it does not..., since it is a special usecase, or how it could be enhanced. So we will come back to this ...
But I am pretty sure you used an outdated plugin version, below 3.58.1.
About using this for an official update, we should play with and find out, what it does and what it does not..., since it is a special usecase, or how it could be enhanced. So we will come back to this ...
But I am pretty sure you used an outdated plugin version, below 3.58.1.
Regards,
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Ian
Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian