TinyPortal

Development => Support => Topic started by: Replayuk on May 24, 2020, 02:25:39 PM

Title: Adding a top block to the forum posting page
Post by: 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.

Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 24, 2020, 02:34:40 PM
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? 
Title: Re: Adding a top block to the forum posting page
Post by: 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
Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 24, 2020, 07:14:03 PM
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.
Title: Re: Adding a top block to the forum posting page
Post by: Replayuk on May 24, 2020, 08:26:26 PM
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>';
Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 24, 2020, 09:26:56 PM
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];
Title: Re: Adding a top block to the forum posting page
Post by: Replayuk on May 24, 2020, 10:45:42 PM
Works great thankyou so much for all your help.
:)
Title: Re: Adding a top block to the forum posting page
Post by: Replayuk on May 25, 2020, 08:24:41 AM
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.
Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 25, 2020, 09:22:13 AM
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.



Title: Re: Adding a top block to the forum posting page
Post by: Replayuk on May 25, 2020, 06:06:33 PM
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

Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 25, 2020, 07:18:49 PM
Quote from: Replayuk on May 25, 2020, 06:06:33 PM
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.


Does the second one not work then?  That should make the banners central.  That's how it is on here, https://cctestsite.info/testsite3/
Title: Re: Adding a top block to the forum posting page
Post by: Replayuk on May 25, 2020, 07:38:13 PM
Not really have a look at the attachment it will show you whats happening.

Thats how its displaying in the main posting area, as the attachment.

Thankyou
Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 25, 2020, 07:43:00 PM
Quote from: Replayuk on May 25, 2020, 07:38:13 PM
Not really have a look at the attachment it will show you whats happening.

Thats how its displaying in the main posting area, as the attachment.

Thankyou

Not sure exactly what you've done.  Please post the code you are using in that PHP block, and add it between code tags.  [code] [/code]
Title: Re: Adding a top block to the forum posting page
Post by: Replayuk on May 25, 2020, 09:28:26 PM
Is there no way we can alter the first bit of code you give me and get it to go centre.
I`ve been looking around and so many confusing topics on it, Must be a way.

Thankyou

Ps thankyou for taking the time out to help me on this subject Lurkalot
Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 25, 2020, 09:48:55 PM
Quote from: Replayuk on May 25, 2020, 09:28:26 PM
Is there no way we can alter the first bit of code you give me and get it to go centre.
I`ve been looking around and so many confusing topics on it, Must be a way.

Thankyou

Ps thankyou for taking the time out to help me on this subject Lurkalot

You removed the screenshot you posted.  Throw us another screenshot of exactly what's happening.  Or better still a link to your site, you can PM the link to me if you don't want it public.

Title: Re: Adding a top block to the forum posting page
Post by: Replayuk on May 25, 2020, 09:57:04 PM
the code you give me in the first section the php code worked perfectly, all i need to figure out is how to make them goto the centre, but i`ll mail you a link so you can view it happening, its in the topic sections.

The banners are all showing, but to the left, i`m after them going into the middle, it must be possible.

Thankyou

Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 25, 2020, 10:39:05 PM
Replayuk, please only post code in a post using the code tags as mentioned earlier.  I have edited your post and added the tags.

I only see one banner on your site at the top, and that one is centred. Are you only using the one banner? 

Unrelated: You also have a banner added to the board description, and that one is way to big and messing with your layout
Title: Re: Adding a top block to the forum posting page
Post by: Replayuk on May 26, 2020, 08:37:19 AM
Now working as we like it thankyou for your time everyone

:)
Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 26, 2020, 08:49:48 AM
Quote from: Replayuk on May 26, 2020, 08:37:19 AM
Now working as we like it thankyou for your time everyone

:)

Thanks. I'll mark as solved.

So what changed, because they still aren't centred as you wanted as far as I can see?  Did you just decide to leave them as is?
Title: Re: Adding a top block to the forum posting page
Post by: Replayuk on May 30, 2020, 10:57:14 PM
Everyone wanted them to stay at the left side, so well what more can i say, But still great work and thankyou.
Title: Re: Adding a top block to the forum posting page
Post by: lurkalot on May 30, 2020, 10:58:36 PM
Quote from: Replayuk on May 30, 2020, 10:57:14 PM
Everyone wanted them to stay at the left side, so well what more can i say, But still great work and thankyou.

No worries.  Glad it's sorted.  O0