vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Need help on best coding approach (https://vborg.vbsupport.ru/showthread.php?t=269217)

TalkVirginia 08-27-2011 06:00 AM

Need help on best coding approach
 
I have a mod I'm working on and in a certain place in my script I'm not sure if I should place the html code in a template or keep it in my script.

example:

PHP Code:


if ( $someval )
{

      
$displaytitle "<a href=\"$link\" class=\"producttitle\" title=\"$title\" style=\"width: $gridcellwidthpx\">$title</a>";

}

/* Render template here  */ 

Does what I'm asking make sense?

In the example above, I'm using the conditionals in the script as opposed to using template conditions to determine if something is displayed.

Which way is better?

nhawk 08-27-2011 10:21 AM

Either method is correct. The same information gets into a template in either case.

Personally, in most cases I prefer to do it in the code.

BSMedia 08-27-2011 02:40 PM

Quote:

Originally Posted by TalkVirginia (Post 2238624)
I have a mod I'm working on and in a certain place in my script I'm not sure if I should place the html code in a template or keep it in my script.

example:

PHP Code:


if ( $someval )
{

      
$displaytitle "<a href=\"$link\" class=\"producttitle\" title=\"$title\" style=\"width: $gridcellwidthpx\">$title</a>";

}

/* Render template here  */ 

Does what I'm asking make sense?

In the example above, I'm using the conditionals in the script as opposed to using template conditions to determine if something is displayed.

Which way is better?

Depends i'd suppose. Are you the only one thats going to use this script? Do you anticipate others using it as well?

If you're the only one using it, do whatever is easiest for you. But if you're going to share it, you might as well save yourself the headache and make it simple as possible for the user.

kh99 08-27-2011 02:57 PM

Quote:

Originally Posted by BSMedia (Post 2238739)
If you're the only one using it, do whatever is easiest for you. But if you're going to share it, you might as well save yourself the headache and make it simple as possible for the user.

I agree - if you're planning to release it here, for instance, I think it's nice to have everything in templates and phrases. Otherwise it doesn't matter so much.

TalkVirginia 08-27-2011 04:14 PM

Thanks for the tips. I'm working on a Zazzle store front for vb actually. I'm planning on adding phrases and templates. I was having a momentary brain fart I guess. It does make sense to have all the html mark up in the template and just use conditionals to turn things off and on.

:up:


All times are GMT. The time now is 01:15 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01037 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete