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,004
  • Total Topics: 21,330
  • Online today: 468
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 204
  • Total: 204

Creating Article Templates?

Started by JOSHSKORN, May 17, 2007, 11:43:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JOSHSKORN

I'd like to create my own template for each article.  Basically, this template would have one color or pattern in the center, and around the edges, would have a border.  Is this possible to add a template?

Alternatively, can I use an existing template, change the size of the image box, send it to the back and put text on top of it?  How would I do this?

Ianedres

I use PHP articles almost exclusively- then place an include statement to reference a HTML file created in an external editor to display the content. This is redundant because TP has an editor, of course, but I use Dreamweaver which helps keep the format somewhat uniform in style, versus no template system in TP.


JOSHSKORN

Quote from: Ianedres on May 18, 2007, 12:56:42 AM
I use PHP articles almost exclusively- then place an include statement to reference a HTML file created in an external editor to display the content. This is redundant because TP has an editor, of course, but I use Dreamweaver which helps keep the format somewhat uniform in style, versus no template system in TP.

Sorry not much of a PHP expert.  So far my site has consisted of copying and pasting code, with me being able to modify bits and pieces here and there.  Can you show me what you've done and how you went about doing it, like which code to use? etc.

Ianedres

In the PHP block, use the following:

include("filename.htm");

By placing the existing HTML file in the same directory as your forums, this will load the contents in that block.

You can place path statements before the filename if you don't wish to have the HTML in the same directory as your SMF/TP forum, but this will get you started for the time being.

Set the block to ON to have it display (my most common error in a rush) and you should now see your HTML file. Don't forget the final semi-colon at the end of the statement.


Peregrinus

Glad I found this topic, very helpful. I was actually looking for a way to add php code to every article, ie meddle with the php file which is the 'template' for articles, however, I couldn't find which file it is. If somebody could tell me I'd be most glad. But, I think I will also try this way of creating a template in Dreamweaver and then using a php article with the include function...great stuff!!!

IchBin

TPortal.php and TPortal.template.php are the files you want to look at.

Peregrinus

Quote from: IchBinâ,,¢ on November 13, 2007, 12:44:17 AM
TPortal.php and TPortal.template.php are the files you want to look at.

OK thanks IchBin, I'll take a look.

Peregrinus

OK,I want to add this code :

echo'<center>';
function selfURL() {
$s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
$protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; }
function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); }

function soc_bookmark($link, $title, $icon = 'Y') {
    $feed = 'feed';
    $link = rawurlencode($link);
    $title = rawurlencode($title);
    $icon_folder = 'bookmarks/icons/';
    $bookmark = array(
        'protopage'=>
'http://www.protopage.com/add-button-site?url='.$link.'&label='.$title.'&type='.$feed,
        'pubsub'=>
'http://www.pubsub.com/index.php?q='.$link,
        'IceRocket'=>
'http://blogs.icerocket.com/search?q='.$link,
        'digg'=>
'http://digg.com/submit?phase=2&url='.$link,
        'BlinkBits'=>
'http://www.blinkbits.com/bookmarklets/save.php?v=1&source_url='.$link.'&title='.$title,
        'BlogMarks'=>
'http://blogmarks.net/my/new.php?mini=1&simple=1&url='.$link.'&title='.$title,
        'Del.icio.us'=>
'http://del.icio.us/post?v=2&url='.$link.'&title='.$title,
        'Fark'=>
'http://cgi.fark.com/cgi/fark/edit.pl?new_url='.$link.'&title='.$title,
        'Furl'=>
'http://www.furl.net/storeIt.jsp?t='.$title.'&u='.$link,
        'Google'=>
'http://www.google.com/bookmarks/mark?op=add&bkmk='.$link.'&title='.$title,
        'Ma.gnolia'=>
'http://ma.gnolia.com/bookmarklet/add?url='.$link.'&title='.$title,
        'MyWeb'=>
'http://myweb2.search.yahoo.com/myresults/bookmarklet?t='.$title.'&u='.$link,
        'Netscape'=>
'http://www.netscape.com/submit/?U='.$link.'&T='.$title,
        'NetVouz'=>
'http://netvouz.com/action/submitBookmark?url='.$link.'&title='.$title,
        'Newsvine'=>
'http://www.newsvine.com/_tools/seed&save?u='.$link.'&h='.$title,
        'RawSugar'=>
'http://www.rawsugar.com/pages/tagger.faces?turl='.$link.'&tttl='.$title,
        'Reddit'=>
'http://reddit.com/submit?url='.$link.'&title='.$title,
        'Scuttle'=>
'http://www.scuttle.org/bookmarks.php/maxpower?action=add&address='.$link.'&description='.$title,
        'Shadows'=>
'http://www.shadows.com/features/tcr.htm?url='.$link.'&title='.$title,
        'Simpy'=>
'http://simpy.com/simpy/LinkAdd.do?title='.$title.'&href='.$link,
        'Slashdot'=>
'http://slashdot.org/bookmark.pl?url='.$link.'&title='.$title,
        'Spurl'=>
'http://www.spurl.net/spurl.php?url='.$link.'&title='.$title,
        'Technorati'=>
'http://technorati.com/faves?add='.$link.'&title='.$title,
        'Wists'=>
'http://wists.com/r.php?c=&r='.$link.'&title='.$title,
    );
    foreach($bookmark as $key=>$value) {
        $link_text = $icon == 'Y' ? '
<img src="'.$icon_folder.str_replace(".", '', strtolower($key)).'.jpg"
border="0" alt="Post to '.$key.'" />' : $key;

        echo '<a href="'.$value.'"
title="Post to '.$key.'" target="_blank">'.$link_text.'</a> ';
    }
}


soc_bookmark(selfURL(), $definePageTitle);

echo'</center>';


...at the end of an article, under or above the

Quote356677442233332 Views | 6574383736376Comments | Rating: (8258759 rates)

...part at the bottom of the article. Problem is, it throws up this error
QuoteParse error: syntax error, unexpected '<' in D:\xampp\htdocs\falconslair\Sources\Load.php(1735) : eval()'d code(209) : eval()'d code on line 1

if I add it into a php article.

If I place the code into TPortal.template.php it just doesn't show up at all. I looked in TPortal.php but can't for the life of me find where it should go.

ps, I haven't done a php article b4, does the code have to be wrapped in <?php  ?> tags? I tried that as well, but it does the same, was just wondering for next time...

TIA for any help :)

IchBin

the <php tags are not required as its already built into the templates.

This website is proudly hosted on Crocweb Cloud Website Hosting.