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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,231
  • Total Topics: 21,353
  • Online today: 651
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 154
  • Total: 154

Add code between articles on frontpage

Started by hsdk, November 02, 2006, 01:59:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hsdk

Yeah, I know that`s one way to solve it, but then i have to reorganize my frontpage every time i write a new article.

Is it reallly impossible to add code where i want? (its a recent topics thingy) :)

Regards A

JPDeni

It's probably not impossible, but Bloc has said that he is considering making another "sticky" article in a future version, so you could wait for that.

I haven't investigated the innards of all of the code to know where it even prints out the articles.

It's not hard to insert a new block wherever you want to insert it. You only have to change one number to put a block any place you want to in the list.

hsdk

Quote from: JPDeni on November 02, 2006, 05:41:20 PM
It's probably not impossible, but Bloc has said that he is considering making another "sticky" article in a future version, so you could wait for that.

I haven't investigated the innards of all of the code to know where it even prints out the articles.

It's not hard to insert a new block wherever you want to insert it. You only have to change one number to put a block any place you want to in the list.

I dont use center blocks on my front page, i just show the last 10 articles. And don`t pin any of them.
So, if i should create 10 blocks on my frontpage, and have the mots recent article show up above my recent topics code i will have to move all my articles down one notch. by selecting one and one for each center block.

Or am i not thinking right?

A :)

JPDeni

QuoteOr am i not thinking right?
Bingo!! :)

If you have blocks, you have something that looks like this:


PosTitle
0Article1
10Article2
20Article3
30Article4

Yes?

So now you want to add Article 5 to the top of the list. It ends up like:

PosTitle
0Article1
10Article5
20Article2
30Article3
40Article4

It always seems to add a new article in the second position. You'd have to change two numbers, I guess, to get it to sort right.


PosTitle
10Article1
0Article5
20Article2
30Article3
40Article4

and hit the Send button, which makes your list end up to be


PosTitle
0Article5
10Article1
20Article2
30Article3
40Article4

Let's say you decide that article 1 needs to be after article 3. Make the changes below:


PosTitle
0Article5
35Article1
20Article2
30Article3
40Article4

Click "Send" and it looks like


PosTitle
0Article5
10Article2
20Article3
30Article1
40Article4

It really is a lot less work than looking through files, altering them, and then having to do it all over again each time a new version comes out, especially if it's in the Source files.

hsdk

I see, but when i write a new article i manually have to select a block to show it in on the frontpage?

I was kind a hoping not to have to do that. :)

Andreas

JPDeni

#15
When you create a new article, you would also create a frontpage block to show it in. Would take you maybe a minute if you're on a very slow server. And this would only be temporary. Bloc has said that he'll likely add a feature which will allow you to do what you want in a later version of TP.

I'm not real keen on writing a whole lot of code when there's a way to achieve the same end without writing the code and there's another even easier way coming along later. Just lazy I guess. :)

Editd to add:
You could also just have your sticky article in a block, your php block and another php block that would show the most recent x number of articles.

hsdk

Okey, I see.

One more thing then. :) If im going to do it this way, i will have to remove the linktree icon that shows on the top of my frontpage. this one -> How could i do this?

See my testsite here: http://www.hsdk.no/andreas/testforum/smf_1-1-rc3_install/index.php

And, THANKS for taking your time to explain this. :)

JPDeni

In TPortal.template.php, right at the beginning of the file, comment out -- put // at the beginning of -- the following lines:

if((isset($context['TPortal']['boardnews'][0]['options']['linktree']) && $context['TPortal']['front_type']!='frontblock') || $context['TPortal']['front_type']=='frontblock')
echo '
<div style="margin-bottom: 4px;">', theme_linktree() , '</div>';

This website is proudly hosted on Crocweb Cloud Website Hosting.