News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

SMF Post Prefix

Started by Diego Andrés, May 11, 2015, 10:37:35 PM

Previous topic - Next topic

natias

Quote from: Diego Andrés on January 23, 2022, 12:58:26 AMWell it's not like the mod doesn't work... You just want to use it along an unsupported custom mod.

Please could you pass me the compatible Mod.

gevv

#321
Hi,

Can the URL Prefix be compatible with Pretty urls ?

http://site/board/?prefix=1

http://site/board/prefix-name

+ Is it possible to add a link to the recent posts list?



ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

landyvlad

gevv you can sort in a forum by prefix, if that's what you mean om the 2nd point. (should accomplish the same result I think)

As far as pretty IURLs what do you mean by compatible with pretty URLs? Do you mean you want the prefix to be included in the URL?  As I understand it that's not possible as the prefix is not part of the title string (which is what pretty URLs uses).  Plus I don't even think it's advisable as prefixes can be readily changed/modified which could leave the pretty URL as misleading.

"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

Diego Andrés

He's looking to have board/prefix/prefix-name and show the filtered prefixes I think.
Not sure if that's feasible, and I haven't used prettyurls to test that tbh.

Quote from: gevv on January 24, 2022, 01:52:57 PM+ Is it possible to add a link to the recent posts list?

It is but requires some extra work. Will attempt this in the future after final release.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Arantor

Fairly sure it requires edits in Pretty URLs itself to support that.

gevv

#325
Hi,

How can I do the linked prefix name and remove prefix topic title header ?



You cannot view this attachment.
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Diego Andrés

Quote from: gevv on February 06, 2022, 01:28:40 PMHi,

How can I do the linked prefix name and remove prefix topic title header ?

Remove this in Sources/PostPrefix/PostPrefix.php
addInlineJavaScript('
                var pp_subject = document.getElementById("top_subject");
                pp_subject.innerHTML = \'' . self::format($context['topicinfo']['prefix']) . '\' + " " + pp_subject.textContent;
            ', true);

The linktree:
Code (Search) Select
$context['linktree'][count($context['linktree'])-1]['extra_before'] = self::format($context['topicinfo']['prefix'], ';text-shadow:none;padding-top:0;padding-bottom:0;');
Code (Replace) Select
$context['linktree'][count($context['linktree'])-1]['name'] = self::format($context['topicinfo']['prefix'], ';text-shadow:none;padding-top:0;padding-bottom:0;margin:0;') . ' ' . $context['linktree'][count($context['linktree'])-1]['name'];
Not sure if you meant linking the prefix to the filter or include it in the topic link, the code does the latter.

SMF Tricks - Free & Premium Responsive Themes for SMF.

gevv

Thanks @Diego Andrés  remove prefix topic title header  ok.  I want to add prefix link

You cannot view this attachment.
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Diego Andrés

Code (Search) Select
global $context;
Code (Replace) Select
global $context, $scripturl, $board_info;
Code (Search) Select
$context['linktree'][count($context['linktree'])-1]['extra_before'] = self::format($context['topicinfo']['prefix'], ';text-shadow:none;padding-top:0;padding-bottom:0;');
Code (Replace) Select
$context['linktree'][count($context['linktree'])-1]['extra_before'] = '<a href="'. $scripturl. '?board=' . $board_info['id'] . '.0;prefix='. $context['topicinfo']['id_prefix'] . '">' . self::format($context['topicinfo']['prefix'], ';text-shadow:none;padding-top:0;padding-bottom:0;') . '</a>';

SMF Tricks - Free & Premium Responsive Themes for SMF.

gevv

ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

gevv

Not a big problem but, perfix name appears in the headers on the paerfix page

Can i remove the prefix of title header on the prefix page
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Diego Andrés

That's how it works, not sure what you mean

SMF Tricks - Free & Premium Responsive Themes for SMF.

landyvlad

Hi Diego!

With the release of 2.1.0 having occurred, is it likely we'll see a compatible version of this prefix mod available in the short term?

Cheers mate.

"Put as much effort into your question as you'd expect someone to give in an answer"

Please do not PM, IM or Email me with questions on astrophysics or theology.  You will get better and faster responses by asking homeless people in the street. Thank you.

Be the person your dog thinks you are.

Diego Andrés

It uses hooks so no issues atm and will install fine
Might work on new features but that's it

SMF Tricks - Free & Premium Responsive Themes for SMF.

gevv

Quote from: Diego Andrés on February 06, 2022, 03:00:12 PM
Code (Search) Select
global $context;
Code (Replace) Select
global $context, $scripturl, $board_info;
Code (Search) Select
$context['linktree'][count($context['linktree'])-1]['extra_before'] = self::format($context['topicinfo']['prefix'], ';text-shadow:none;padding-top:0;padding-bottom:0;');
Code (Replace) Select
$context['linktree'][count($context['linktree'])-1]['extra_before'] = '<a href="'. $scripturl. '?board=' . $board_info['id'] . '.0;prefix='. $context['topicinfo']['id_prefix'] . '">' . self::format($context['topicinfo']['prefix'], ';text-shadow:none;padding-top:0;padding-bottom:0;') . '</a>';

Hi,

Can we add "title" to the link?

I tried the following code only "i" appeared

" title="'. $prefix['name']. '"
You cannot view this attachment.
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Diego Andrés

It looks like you have a typo there, an extra "

SMF Tricks - Free & Premium Responsive Themes for SMF.

gevv

Thanks @Diego Andrés   I edited and the output was title="a href=" 

Error log:  Illegal string offset 'name'
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Diego Andrés

Where did you get $prefix['name'] though? That's not used anywhere.
You want to use $context['topicinfo']['prefix']

SMF Tricks - Free & Premium Responsive Themes for SMF.

gevv

Quote from: Diego Andrés on February 15, 2022, 02:51:44 PMWhere did you get $prefix['name'] though?

line 99 I extracted from icon codes


 You cannot view this attachment.
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Steve

Hey Diego, is there a limit to the number of prefixes?

And does it count against the number of characters a topic title can have?
DO NOT pm me for support!

Advertisement: