text template replacing a short code in each post where it is present

Started by occhio.nero, January 30, 2017, 10:25:47 AM

Previous topic - Next topic

occhio.nero

I'm not sure it's the correct section to post my query.
I've tried to find similar requests with "search" command, but no success. Unfortunally searhing for "template" give back tons of bad results. Actually, I'm not even sure to manage to explain the issue.

So, sorry for any mistake.

In few words......

-------------------------

I 'd like to start a topic (i.e Topic_A), in the first post, listing URLs of related topics, in order to help members approaching to Topic_A, to find related information more easily.

Example:
Topic_A: "cycling during winter"
Related Topic RT1: "choosing warm gloves"
Related Topic RT2:  "braking in snow storm"
.........

At the moment the solution adopted is edit the first post of the Topic_A, manually inserting  the list of related topics URL (UrlRT1,UrlRT2,.....) .

But since different topics (topic_A, Topic_B, ...) may share the same list of related topics (RT1, RT2, ..) , every time I need to update it, I should repeat editing  in each topic (TopicA, TopicB, ...).

I wonder if there is a way to put into the first post of each topic (topic_A, Topic_B,  just a code (i.e: <replace>CODE1</replace>)

in order to modify CODE1 just once (when I need to update the list of related topics UrlRT1, UrlRT2, ...), as modification will be automatically shown in each topic (Topic_A, Topic_B, ....) where I've inserted this "CODE1".

In other words, I'm thinking about a "template" (called also "library", if I'm not wrong)  for each list of related topics (CODE1, CODE2, ....), automatically inserted from SMF loading Topic_A, Topic_B, ....

Any suggestions?

Thanks in advance.

-------------


I 've already tried these MODS:

1) "TaggingSystem3.0.1"  ( http://custom.simplemachines.org/mods/?mod=579 )
too much complicated

2) "related topic" (http://custom.simplemachines.org/mods/index.php?mod=189 )
the automatic list generated is very rough

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."


occhio.nero

using this method, unfortunately  I can't automatically  update each recurrence every time I decide to update the censored word into censored-word-administration-panel.

Infact, first time I save the post containing the censored word, it is replaced by the text string set into censored-word-administration-panel.

Any other idea?  :-[

nend

I use related topics, but like you mentioned the default fulltext library is a little rough as it only considers topic titles. However if your wanting to give it another try I'll share my library which includes the message body and strips out common words where only mainly key words are left behind.

Kindred

that is not the way that the word censor works...

it does not repalce the word in the stored message... only in the DISPLAYED messaged...   it is triggered and run at display time only.

so, yes... if you set the word "BLAH!" to be replaced by "blahblahblahblah" and then change it later to "blehblehblehbleh" the change **WILL** take effect on all instances of "BLAH!"
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

occhio.nero

thanks for replying.
Quote from: Kindred on March 10, 2017, 01:54:14 PM
it does not replace the word in the stored message... only in the DISPLAYED messaged...   
That's my fault. I'm going to explain my situation  in a better way.
The censored word remain the same (for instance: "RLTTT"). Time by time  I will  change only  the related  replacing-string (for instance: "Related Topic List: topic1, topic2"  will become "Related Topic List: topic1, topic2, TOPIC3" after a month).
The first time I write a new post containing the censored word ("RLTTT"), when I click "save"  (to post the message), the correct replacing-string compares (for instance: "Related Topic List: topic1, topc2"). PERFECT.
But If, after a month, I update the replacing-string (for instance: "Related Topic List: topic1, topic2, TOPIC3", not the censored word) and then refresh the browser, into that post old string remains ("Related Topic List: topic1, topic2").
Infact, If I click "modify" (as admin, to modify that post), I can verify "RLTTT" occurrence doesn't compare anymore. It's been replaced by the text string "Related Topic List: top......" once and for all. No way to go back.

Instead, I'm looking for a mechanism keeping occurences into posts. Maybe this function is not available to avoid extra load to server (that It would be forced to replace string text every time a user open that post, not just at "first save").
For instance, into Dreamweaver software (a software designed  to create web sites), you can create as many "libraries" as you want. Any "Library" contains a text string (for instance: "Related Topic List: topic1, topc2") and It is related to a "text code" (for instance: "RLTTT") that I can insert into web pages permanently. I have just to update the specific library to update any occurrence into the web pages.



Quote from: nend on March 10, 2017, 10:42:44 AM
I'll share my library
That's interesting. May you help me? I don't know how to do it at all. I'm  a beginner.

Kindred

what you are seeing is NOT the standard behavior.

When I make a post with the string "RLTTT" it STAYS as "RLTTT"
it does NOT get replaced with the censor/replacement string in the SAVED message.
it ONLY gets replaced when the message is DISPLAYED to a user who has the censor turned on.

So... it I say (in the censor) replace RLTTT with www.yoursite.com/relatedtopicURL and I later change that to be www.yoursite.com/DIFFERENTrelatedtopicURL, the system will now show all RLTTT as the second one... not changed needed on a per-post basis.

If you are seeing the phrase RLTTT get replaced by the other string in the actual message when you go to edit, then you have done something to your code which is changing the core behavior of SMF and making it do something which it is not originally designed to do.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

nend

I believe I worked out the dependencies, but backup your current file first before you try this one.

Upload this to your Sources folder and it should make the Related Topics modification more relevant.

occhio.nero

thanks for replying  :)

@Kindred: Actually I've installed several mods. I'm planning to go back to previous version to set the original behaviour

@nend: I'm going to reinstall "Related_Topics_1.4.1.tar.gz" mod, replacing php file you have shared. Any suggestion in order to make related topic list more relevant?
for instance: write at the top of first post (of related topics) the same TAG 

Advertisement: