Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-11-01 21:16:55

nemadeka
New Member
Registered: 2014-11-01
Posts: 2

Need basics for forum search: html embed and threaded comments

Dear all,
I have an abandoned project dedicated to English learning, which I want to revive.

The basic page of the old site looks like this — http://nemadeka.com/unfe/jk_001_020/_jk_005_GPS_cat.htm
It is a joke below which there are the writer’s comments about grammar, usage, a tiny exercise and a form of an online dictionary.

I want to find a plugin, a method, anything, which would allow me to write an html file with the new joke, upload it, and Textpatterm would detect a new file and create a new article based on it, including formatting, and append threaded comments, where the visitors would ask questions, and I and other visitors would answer them.

After reading much of this site I must admit I am lost. I am not programmingly hopeless, I wrote this moderately popular utility (http://nemadeka.com/tagger.htm) which replaces a 600-euro software package, has variables declared, an external script from where values are read, a function to which the values are passed, other basic stuff. It was easy to create it because it is VBA, and it has tons of reference and user forums.

If the plugin I need does not exist, please, kindly provide search keywords.
Or tell me that I cannot do what I want to.

Thank you!
AO

Offline

#2 2014-11-02 09:36:09

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,915
Website GitHub

Re: Need basics for forum search: html embed and threaded comments

Hello AO and welcome!

If I am to be honest, you can streamline your workflow considerably by posting directly to your textpattern site. You don’t need to write in HTML, you don’t need to create a file, you don’t need to upload it, you don’t need to write a way to import it into textpattern and you don’t need to hook it up with a separate commenting system.

Textpattern uses “Textile”, a shorthand notation for HTML that is quickly learned, especially if you’re familiar with html, and creates clean code. You can play with it at txstyle.org. It does things like converting quotes automatically and is fine with Russian too.

For example, for your post above, you’d just need to enter the joke name in the “Title” field, e.g.:

Is Cat There?

And the following in the “Body” field:

A man absolutely hated his wife's cat and decided to get rid of him one day by driving him 20 blocks from his home and leaving him at the park.

As he was getting home, the cat was walking up the driveway. The next day he decided to drive the cat 40 blocks away. He put the beast out[1] and headed home. Driving back up his driveway, there was the cat![2]

He kept taking the cat further and further and the cat would always beat him home. At last he decided to drive a few miles away, turn right, then left, past  
the bridge, then right again and another right until he reached what he thought was a safe distance[3] from his home and left the cat there.

Hours later the man calls home to his wife: "Jen, is the cat there?"[4]
 "Yes", the wife answers, "why do you ask?"
Frustrated, the man answered, "Put that son of a bitch on the phone[5], I'm lost and need directions![6]"

 fn1. He put the beast out - он высадил зверюгу

 fn2. there was the cat! ~ а вот и кот!

 fn3. until he reached what he thought was a safe distance - пока не отъехал, как ему казалось, на безопасное расстояние

 fn4. Jen, is the cat there? - Джен, кот дома?

 fn5. Put that son of a bitch on the phone - позови этого сукиного сына к телефону

 fn6. directions - букв. 'направления', что выражается русским 'дорога'. 'показать дорогу' = 'дать направления' = 'to give directions'

(Note: if you’re not seeing it all, scroll the box above to the right. You can play around with this on txstyle, and display the corresponding html output if you want to experiment further.)

Now all you need to do is assign that article to the /joke section or category and click Save, and it’s published. That is more or less all you need to do to add a new joke.

In the above example I’ve used [1] to mark the position of footnote 1 and then at the bottom fn1. footnote text for the corresponding footnote text (each on a separate line). Textpattern automatically links them up. Firstly, this is easier to type than creating inline comments, and secondly it gives you a better printout (like in your PDF files) and code that can also be read by screenreaders. If you’d rather that they show on the page as tooltips, I suggest using a jquery/javascript tooltip plugin that automatically brings in the tooltip from its respective footnote: Here’s an example of how that could work.

For the bits beneath that, I suggest handling them as follows:

  • As the link to the dictionary and the search field is the same for every joke, I’d put the code for that in a separate textpattern form and bring it into your page tempalte. That way if something changes with the search form, or you’d like to use another site, … or your dictionary allows you to include the search terms in your own site, whatever, you can change it at a later date in one place and it then works in all your articles.
  • For the pdf download, I suggest uploading that (as a PDF file – no need to zip it first) to the Content > Files panel in Textpattern. Each uploaded file is assigned an ID-number. Then, in your textpattern article with the joke, you specify the ID number of the corresponding download using a custom field. You can then add a snippet of code to your page template that creates the download link if one is available. You wouldn’t need to hand code that every time.

Otherwise, Textpattern handles the menu, the next/prev links at the bottom and so on automatically without you having to code them. Likewise, the index of joke articles is automatically created from the titles. If you also have other examples, e.g. stories, poems, newspaper articles … you can group your examples by category. Your “clean/mature” rating could also be a second category, or maybe more simply a custom_field as a tickbox (there’s a textpattern plugin called glz_custom_fields for that). Finally, textpattern has an in-built commenting system.

As far as I can tell, you have 12 joke articles at the moment, so it wouldn’t be a big job to rejig them for textile. If you need a hand, let us know…


TXP Builders – finely-crafted code, design and txp

Offline

#3 2014-11-02 13:52:19

nemadeka
New Member
Registered: 2014-11-01
Posts: 2

Re: Need basics for forum search: html embed and threaded comments

Wow, this is a complete tutorial!
Thanks a lot for your input, it is exactly what I need.
Stay well
Alex

Offline

Board footer

Powered by FluxBB