Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-12-27 00:46:32
- jstur8jv
- Member
- Registered: 2006-12-23
- Posts: 23
[request] allow comments to be associated with images and files
I’d like to be able to associate comments with images and files, not just articles.
I don’t think it should require too much tinkering to modify the current functions to allow an id-type flag that differentiates between files and images that defaults to articles if not set.
Anyone familiar enough with how the comment system works to make it happen?
Offline
Re: [request] allow comments to be associated with images and files
I think the “problem” is that there isn’t an “individual-image” context as an “individual-article” context.
Are you trying to setup a photolog? I mean, something like this photoblog
So, why don’t you associate an image to an article, so visitors can leave the comments to that article that just includes an image?
It’s as easy as adding this to your “photoblog” section’s page template:
<txp:article form="image" limit="1" />
And create an article form named “image” with just this:
<txp:article_image />
- create an article (in Content > Write tab),
- add an article image (under Advanced options)
- and publish it in your “photoblog” section.
Visitors will be able to publish comments to that image-article.
Offline
#3 2006-12-27 09:28:37
- jstur8jv
- Member
- Registered: 2006-12-23
- Posts: 23
Re: [request] allow comments to be associated with images and files
I’m hoping to avoid article pages all together. One the one hand, doing so just makes sense; items and files feel (to me, and this is certainly not a criticism of textpattern) as though they should be as robust and complete entities as articles. It makes sense that files should be able to have comments associated with them, and so should images.
On the other hand, and the primary reason, is that I’m trying to make the process of adding photos and a few specific types of files as simple as uploading the file or photo, filling out whatever fields, and then picking the category—all on the same screen, and separate from the screen used to write a post or article.
I literally wrote my first line of php a few days ago, otherwise I would attempt to do it myself. But I looked at as much of the textpattern code as I could, and I was completely lost, and I’m not sure I have the right birds-eye-view of exactly how the comments function in order to effectively alter them.
So: would it be possible to clone all comment-related functions twice and add a prefix (such as, i_comments and f_comments, i_comment_web_input, etc), and for i_comments (and f_comments) alter it so that the function refers to a new set of tables for storage in the database (if necessary), to the image (or file) id instead of an article’s, and also refers to other i_ or f_ functions when it runs instead of the un-prefixed comment functions, but is otherwise unchanged?
The only other thing I could think that may have to be done is a query might need to be run when making a file or image to create a database entry for comments, if doing so is an integral part of the comment system and part of how it works with articles.
Doing this—just cloning the comment functions—would minimize the work that needs to be done, right? Would you (anyone) who really understands the dependencies be willing to give it a shot?
Last edited by jstur8jv (2006-12-27 09:29:26)
Offline
Re: [request] allow comments to be associated with images and files
The easiest way to achieve your goal, is to auto-insert articles when images or files are uploaded. Articles are the entities that other stuff evolves around, it doesn’t really make sense to duplicate that several times. What is more likely to happen is, that in the future the uploading of images/files will (from an UI standpoint) move closer to creation of articles.
For your needs, especially in terms of what can be achieved with reasonable work in a plugin, it’s the better approach to auto-create articles on uploads, and the next solution to alter the article-creation UI (more work, and harder to get right).
Offline
#5 2006-12-29 13:05:54
- jstur8jv
- Member
- Registered: 2006-12-23
- Posts: 23
Re: [request] allow comments to be associated with images and files
I think I’m going to try and write the plugin myself. It’ll be a good chance to learn some more php.
I have a big question to start with, though. When you use the <txp:comments id=“x” /> tag, exactly what function(s) are called? Everything in the comments.php file? Or is there a particular function in there that is accessed specifically?
Offline
Re: [request] allow comments to be associated with images and files
I second this request. The approach Sencer outlined would be fine for my need also.
In particular, anyway, it would be optimal if there was a way to associate the image with the article/comment. I would like to be able to call the comments within image manipulation tags, not articles tag, even if auto-article are created. I think this would involve a new table creation to build the relationship between images and auto-article, but I’m guessing.
Bye
Z-
Offline
Re: [request] allow comments to be associated with images and files
See these articles to get started.
- Ben
Offline
#8 2007-03-20 10:29:01
- feragnoli
- Member
- From: the hague
- Registered: 2005-02-10
- Posts: 150
Re: [request] allow comments to be associated with images and files
@ sencer
The easiest way to achieve your goal, is to auto-insert articles when images or files are uploaded.
I agree completely, how do you achieve that?!?
Last edited by feragnoli (2007-03-20 10:30:14)
what was that again…?
Offline
Re: [request] allow comments to be associated with images and files
Create a plugin, hook it so that’s it’s triggered when an image is uploaded, and script the article creation and data insertion. Shouldn’t be too hard.
Offline