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

Recent

Welcome to TinyPortal. Please login or sign up.

May 01, 2024, 06:49:13 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,174
  • Total Topics: 21,220
  • Online today: 177
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 127
  • Total: 128
  • @rjen

Adding a top block to the forum posting page

Started by Replayuk, May 24, 2020, 02:25:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Replayuk

I was thinking of adding a banner modification, But then i thought would it be possible to add a block to the top of each forum where they post and put the banner code into the block.

Does anyone have any idea`s if this would work.

Cheers for reading everyone.


lurkalot

Quote from: Replayuk on May 24, 2020, 02:25:39 PM
I was thinking of adding a banner modification, But then i thought would it be possible to add a block to the top of each forum where they post and put the banner code into the block.

Does anyone have any idea`s if this would work.

Cheers for reading everyone.

Do you want to show the same single banner, or a batch of random displayed banners to each board, or all pages? 

Replayuk

Random banners to advertising companies on if thats possible, would this be in html code to add to the block that i`m going to be putting in the sections,
P:s yes it needs to be displayed on all pages in posted areas.

Thankyou

lurkalot

Quote from: Replayuk on May 24, 2020, 06:28:07 PM
Random banners to advertising companies on if thats possible, would this be in html code to add to the block that i`m going to be putting in the sections,
P:s yes it needs to be displayed on all pages in posted areas.

Thankyou

You could use script such as this one, https://markinns.com/archive/random-banner-script-using-php.html

Added to a php block  Obviously you'll have to add your own images and urls, but as an example I just stuck it on the top of one of my test sites, It should change banner randomly every page load. https://cctestsite.info/testsite3/index.php

Or if you're not using the news function for anything in SMF, then you can also use that to do the same thing. And display that in a TP news block.

Replayuk

#4
So how would i make that happen, say this is my link to my logo`s i want to be rotated.
http://www.tomysite.co.uk//forum/Header/blurrblurr.png" />

And Below is the php code, how would the link be put into that code below, If you could give me an example so i can modify the php code to get the link to banner logos.

<?php
$advert 
= array();
  
$advert[] = '<a href="#">Banner 1</a>';
  
$advert[] = '<a href="#">Banner 2</a>';
  
$advert[] = '<a href="#">Banner 3</a>';
shuffle($advert);
echo 
$advert[0];
?>


I was thinking it could be something like this maybe.

$advert[] = '<a href="#">http://www.tomysite.co.uk//forum/Header/blurrblurr.png" />
</a>';

lurkalot

You don't need to ad the php tags when adding to a php block, so I've removed them below. And added what you need to add where,


$advert = array();
  $advert[] = '<a href="link to vendor"><img src="link to image"></a>';
  $advert[] = '<a href="link to vendor"><img src="link to image"></a>';
  $advert[] = '<a href="link to vendor"><img src="link to image"></a>';
shuffle($advert);
echo $advert[0];

Replayuk

Works great thankyou so much for all your help.
:)

Replayuk

I was just wondering as the code above does work great for what i`m after, but could it be made possile to alter the code so the banners its displaying would be made central.

Thankyou for your time helping out.

lurkalot

I'm not good with this css stuff, so on my example I just wrapped each banner in a html center tag.  But I believe that's not recommended nowadays.  So you could also do it like this, which is on my testsite atm.


$advert = array();
  $advert[] = '<a href="link to vendor">[code]
$advert = array();
  $advert[] = '<a href="link to vendor"><p style="text-align:center;"><img src="link to image"></a></p>';
  $advert[] = '<a href="link to vendor"><p style="text-align:center;"><img src="link to image"></a></p>';
  $advert[] = '<a href="link to vendor"><p style="text-align:center;"><img src="link to image"></a></p>';
shuffle($advert);
echo $advert[0];


Obviously if you search around on the web you'll probably find better solutions for doing all this random banner stuff, there's loads of different options out there.




Replayuk

#9
I`m very happy with the first php code i was just wondering if there is a command that i could add to that php code at the top to make the banner images go central.


That would be perfect, or is there a setting in tiny portal that i can click to make the block go central.

So using this code there must be some way of making the images go central.


$advert = array();
  $advert[] = '<a href="link to vendor"><img src="link to image"></a>';
  $advert[] = '<a href="link to vendor"><img src="link to image"></a>';
  $advert[] = '<a href="link to vendor"><img src="link to image"></a>';
shuffle($advert);
echo $advert[0];



Thankyou for taking the time to help