News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Coding in specific area

Started by Biology Forums, June 13, 2011, 04:08:38 PM

Previous topic - Next topic

Biology Forums

Is there a way of making something (say an image) show up only if the user is in the posting page of a thread? For instance,

if (in post.template) echo ' so-and-so '; else echo ' nothing ';




All Colours Sam

you can directly put it on post.template.php   or /Post.php and use $context['something']  to print that on your template file
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Biology Forums

Quote from: shuban on June 13, 2011, 04:08:38 PM
Is there a way of making something (say an image) show up only if the user is in the posting page of a thread? For instance,

if (in post.template) echo ' so-and-so '; else echo ' nothing ';

I know this trick, but it's for a tinyportal pod, so could it be done another way?

All Colours Sam

 check for action=post 

if($_REQUEST['action'] == 'post')
   echo 'something'; 
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Masterd

Using $context['current_action'] is better.

Biology Forums

Quote from: Masterd on June 14, 2011, 10:56:11 AM
Using $context['current_action'] is better.

Example please...

Quote from: Miss All Sunday on June 14, 2011, 07:30:49 AM
check for action=post 

if($_REQUEST['action'] == 'post')
   echo 'something'; 

Thanks, I will try that!

Biology Forums

You showed me 'post', but what if I wanted the image to show in topic view only (i.e. when you're viewing a thread, and nothing else).

All Colours Sam

you said "only in the posting area"...

check if $_REQUEST['topic']  is set  with  isset();
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Biology Forums

Quote from: Miss All Sunday on June 14, 2011, 10:47:23 PM
you said "only in the posting area"...

check if $_REQUEST['topic']  is set  with  isset();

I don't understand what you mean... I would like something tos how only if it's in topic view

Matthew K.

Exactly...it's the same thing Masterd.
Quote from: Masterd on June 14, 2011, 10:56:11 AM
Using $context['current_action'] is better.

Masterd

Yeah, I know, but in some cases it's easier to use it.

All Colours Sam

Quote from: shuban on June 16, 2011, 08:55:15 PM
Quote from: Miss All Sunday on June 14, 2011, 10:47:23 PM
you said "only in the posting area"...

check if $_REQUEST['topic']  is set  with  isset();

I don't understand what you mean... I would like something tos how only if it's in topic view


if (isset($_REQUEST['topic']))
   // my code to show only if a user is viewing a topic


Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Biology Forums

Quote from: Miss All Sunday on June 17, 2011, 09:20:40 AM
Quote from: shuban on June 16, 2011, 08:55:15 PM
Quote from: Miss All Sunday on June 14, 2011, 10:47:23 PM
you said "only in the posting area"...

check if $_REQUEST['topic']  is set  with  isset();

I don't understand what you mean... I would like something tos how only if it's in topic view


if (isset($_REQUEST['topic']))
   // my code to show only if a user is viewing a topic

Thank you!

Advertisement: