views:

28

answers:

1

Hi everyone!

I currently have a site with multiple articles being user-generated as content. On each new post, there is a hidden $getcurrentpageurl variable. When a user is reading a post (x), a form button saying "respond to this post" sends the user to a submit form, in which a hidden field catches the posted $getcurrentpageurl, and inserts it automatically into the new article (y).

By doing so, the new article(y) can then display something like: "This post is in response to www.mysite.com/articles/thearticle(x0"

My question is, how would I go about transforming that url into the article x's title and presenting it as a link to said url?

If it helps, all posts are saved to an sql database; there is a title field, a text field etc, so I could theorically extract a title from the title field, but I can't figure out how to organize it all to be automated. Let me know if this needs clarification!

Thanks in advance!


More details:

The database $getcurrentpageurl variable is what it says, it reads the current's article's url. When the user presses the "Respond to this post" button, it is sent as POST information onto the submit-article form. In that form, the user can write a Title, choose a category for his article, and write a post into a regular textbox. There is a hidden field for which the value is the POST information, thus the initial article's url.

When the article is saved, it is then presented as follows :

TITLE

Text

This article is a response to :

    <a href="*url-of-the-repsonded-to-article*">*url-of-the-responded-to-article* </a>

I apologize if I am not being clear, I am quite confused with the process myself!

A: 

I don't understand really how you set it up.

It sounds like you could really benefit from having a simple article table, comment table, and user table kind of set up, where the comment table references the article table's id number (not the url or whatever).

That way you can literally just get the title by doing a query as simple as:

SELECT `title` FROM `articles` WHERE `article_id` = (x);

to find the title.

Then you just have a page like "fetcharticle.php?id=x" and it will be as simple as that.

Crowe T. Robot
It would definitely make much more sense, the problem is I am doing this as a work around in a Joomla template, and I was trying to not touch the existing article insertion system, simply add to it. I think I will simply go with making my url's display as "This article". The link will lead to the url, but it will always look as This article is a response to "This article", or something like it. Thanks for your answer!
skarama