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

Recent

Welcome to TinyPortal. Please login or sign up.

May 02, 2024, 11:06:06 AM

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

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


lurkalot

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/

Replayuk

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

lurkalot

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]

Replayuk

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

lurkalot

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.


Replayuk

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


lurkalot

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

Replayuk

Now working as we like it thankyou for your time everyone

:)

lurkalot

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?

Replayuk

Everyone wanted them to stay at the left side, so well what more can i say, But still great work and thankyou.

lurkalot

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