TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,022
  • Total Topics: 21,332
  • Online today: 473
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 319
  • Total: 319

Want to add a link inside each and every forum post on TP front page

Started by felcon, August 10, 2007, 08:04:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

felcon

Hi all...

        I want to add a link inside each and every forum post on TP front page. I'm going to limit the number of words inside every forum post to some number and add   the link "read more" so when clicked on this link too, anyone can go to the post in the forum to view it.

   Where should I edit in the code to do that?..In which file?..Can G6 or IchBin or anyone pls help me..?

Thanks

IchBin

I'm thinking that this is probably in the TPortal.php file. Not 100% sure though. Its not something you can just edit. You have to create the code to stop after soo many characters and then create the code to create a link to the rest. Don't have the time to try and figure it out myself. Maybe someone else will.

Zetan

Depends on how you are displaying posts on the home page.

Quote from: carver on August 07, 2007, 03:48:31 AM
To add a "Read More " link back to the original post from the front page

open TPortal.php

Find:
$row['body'] .= '...';

and Replace with:
$row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">  .... Read More</a>';

This will replace the  "..." at the end of a cut off post on the front page with a link back to the post if that is what you were asking..




Or if you are using an SSI function like I do, use this instead
Editing: /public_html/SSI.php

Find
$row['body'] .= '...

and add after it:


$row['body'] .= '...[<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">Read_More</a>]';


I've now changed the [Read_More] to just ...[More]

felcon

Thanks a looot Mr. Zetan!!  :up: great.. That's what I wanted exactly. Anyways alternating the SSI.php file is better when I'm concerned..

  Sir I have another question.. :idiot2: Now I'm trying to make some new .php files and link them for example, to a new link next to the board name in the Board Index. But the  url should use  the pattern  $scripturl. '?action=my_new_page.php' , otherwise link will open a new page without the TP theme.

  I've been trying to find where the above-pattern links are created for top menu bar's custom pages. But still I coudn't find. I thought if I could find that then I could get some idea what to do. Can you pls tell me how to do that?...(I found $settings['custom_pages']  in index.template.php in scribbles11_tp folder.. But don't knw in which file that variable is set. Is it relevant to what I'm going to do? )

  I'm really sorry If I'm bothering you..  please help me..

Many Thanks..

IchBin

I don't think you can add an action link with the file. You should probably do a custom action in SMF instead.

How to create custom 'action'
http://www.simplemachines.org/community/index.php?topic=23864.0

felcon

Thanks for the tip Mr. IchBin. I will try..I too think that's the way to go..


This website is proudly hosted on Crocweb Cloud Website Hosting.