View Single Post
  #2  
Old 29 Oct 2018, 12:18
x iJailBreak x's Avatar
x iJailBreak x x iJailBreak x is offline
 
Join Date: Jan 2011
Originally Posted by TransAmDan View Post
I want to access a database value from a VB template. The template is shown below. I have a new field in the 'attachment' table, called 'external_source' by default this will be zero, but if it is a 1, I want to produce different HTML code.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Looking inside album.php I have modified the call to the database to include this field too.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

So now $pictures contains the information from that database query.

Each individual pictures is fetched from
while ($picture = $db->fetch_array($pictures))

So in the template code I would expect pictures.external_source to contain the data from the database. Something isn't working right.

Is there some other process it goes through to pass data from album.php to the 'album_picturebit' template?
If you do var_dump($pictures), what is the output?

Also, as a rule of thumb, it's best not to modify the core files - you should be able to utilize $hook_query_fields with the nearest hook to avoid making core changes to the code. Making core changes to the vB codebase is inadvisable as it can make it more difficult to upgrade, and usually means after upgrading the same changes need to be carried out again.
__________________
Professional web developer & sysadmin. Former bad man.
Reply With Quote