xoops forums

seesoe

Just popping in
Posted on: 2009/11/23 7:00
seesoe
seesoe (Show more)
Just popping in
Posts: 33
Since: 2007/1/3 4
#1

accessing database from theme.html

hello, i am working on an embedded marquee that has user profile avatars. im trying to use the XOOPS system to access the user_avatar fields of users from the user table

im working within the theme.html file, is there a way to do this with smarty?

or would it just be easier if i write some php code and embed it within the theme.html page? (didn't really want to do this because the php code is displayed in normal text when viewing. (in regards for the database access info))

if anything is there a way to include some file in the theme.html that will connect to the database?

thanks
cheers
seesoe

kris_fr

Theme Designer
Posted on: 2009/11/23 9:16
kris_fr
kris_fr (Show more)
Theme Designer
Posts: 1009
Since: 2005/12/31
#2

Re: accessing database from theme.html

hi,

look here --> http://www.frxoops.org/modules/newbb/ ... t_id=82400#forumpost82400

@+

seesoe

Just popping in
Posted on: 2009/11/23 14:54
seesoe
seesoe (Show more)
Just popping in
Posts: 33
Since: 2007/1/3 4
#3

Re: accessing database from theme.html

Hmmm not exactly what I'm after, Im looking to be able to get all the user avatars from the user table If not blank.gif then echo the file name of the avatar


Which system php file could I modify so that when avatar filenames are renamed on upload I can put a prefix on the file?

red_Slider

Quite a regular
Posted on: 2009/11/23 15:08
red_Slider
red_Slider (Show more)
Quite a regular
Posts: 248
Since: 2006/1/4 1
#4

Re: accessing database from theme.html

how about that in block system_block_topusers.html

<{if $user.avatar != ""}> <div class="center"> <table>     <tbody>         <tr>             <td style="height: 50px; vertical-align: bottom;"><a title="<{$user.name}>" href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><img width="40" alt="<{$user.name}>" src="<{$user.avatar}>" /></a></td>         </tr>         <tr>             <td><a title="<{$user.name}>" href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><span class="forum_desc"><{$user.name}> <br />(<{$user.posts}>)</span></a></td>         </tr>      </tbody> </table> </div> <{else}> <div class="center"> <table>     <tbody>         <tr>             <td style="height: 50px; vertical-align: bottom;"><a title="<{$user.name}>" href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><img width="40" alt="<{$user.name}>" src="<{$xoops_url}>/modules/profile/images/noavatar.gif" /></a></td>         </tr>         <tr>             <td><a title="<{$user.name}>" href="<{$xoops_url}>/userinfo.php?uid=<{$user.id}>"><span class="forum_desc"><{$user.name}> <br />(<{$user.posts}>)</span></a></td>         </tr>      </tbody> </table> </div> <{/if}> <{/table_foreach}>

Dylian

Friend of XOOPS
Posted on: 2009/11/24 1:57
Dylian
Dylian (Show more)
Friend of XOOPS
Posts: 237
Since: 2007/7/21
#5

Re: accessing database from theme.html

I have made a hack to do what you wan't, here's how to do it:

Step 0:
Download the avatarScroller package.
Step 1:
Upload the avatarScroller directory in the package to your XOOPS upload folder. (xoops_root/uploads)
Step 2:
Open xoops_root/header.php in your favorite editor and search for the line:
$xoopsTpl =& $xoTheme->template;

and replace it with:
$xoopsTpl =& $xoTheme->template;
include(
XOOPS_ROOT_PATH.'/uploads/avatarScroller/avatarScroller.php');

save/upload the edited header.php /
Step 3:
Place the smarty tag <{$avatar_scroller}> in your theme/template/block where you want to display the avatar scroller.

NOTE: jquery is needed for this hack to work! If you dont have jquery included in your theme please open avatarScroller/avatarScroller.php and follow the instructions.

Greets Dylian.

BTW To change the looks of the scroller edit avatarScroller/avatarScroller.js and avatarScroller/avatarScroller.css