Support Forums

Old 01-19-2007, 11:57 AM   #1
The Master
 
Maffo's Avatar
 
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 46
Maffo is just really niceMaffo is just really nice
Default Module Variables

Sorry buts its a long time since I have messed around with modules and have a basic question.

On my includes/init.php I have several custom variables that I use throughout the program. They appear on everypage but they dont assign when using a module? Any reason for this?
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers.
Maffo is offline   Reply With Quote
Old 01-19-2007, 12:00 PM   #2
68 Classifieds Staff
 
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,291
Rep Power: 123
Eric Barnes is a jewel in the rough
Default

The only reason I would think they wouldn't appear is if they have been redefined some where else.
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 01-19-2007, 12:08 PM   #3
The Master
 
Maffo's Avatar
 
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 46
Maffo is just really niceMaffo is just really nice
Default

Nope, its a very strange one, I can get by creating a new functions file inside the actual module, but ovbiously if I edit one, I have to remember to edit the other.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers.
Maffo is offline   Reply With Quote
Old 01-19-2007, 12:41 PM   #4
Coder
 
Join Date: Mar 2006
Posts: 4,742
Rep Power: 115
Lhotch is a glorious beacon of lightLhotch is a glorious beacon of lightLhotch is a glorious beacon of light
Default

Are these variables being assigned within the module itself or is the module pulling them from elsewhere?

Are you sure the variable is getting properly assigned within the module function? Have you tried to echo or print the variables within your module function to make sure they are getting properly assigned?
__________________
Larry

What I post here should be used only as a guide to point you in the right direction. If the code I post doesnt make any sense or work as posted then you should spend more time reading the various manuals and tutorials so it does make sense and you can tweak it to work. A sure fire way to get yourself in trouble is to implement changes you dont have an intimate understanding of. Im happy to help, but I am not here to teach you to code or create your site for you.
Lhotch is offline   Reply With Quote
Old 01-19-2007, 12:57 PM   #5
The Master
 
Maffo's Avatar
 
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 46
Maffo is just really niceMaffo is just really nice
Default

Like I say the variables work fine on every other page except for the module page. They are not being pulled from anywhere else and are not appearing inside the debug window.

What I think is happening is that php variables are being allowed but the smarty variables arent.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers.
Maffo is offline   Reply With Quote
Old 01-19-2007, 01:07 PM   #6
Coder
 
Join Date: Mar 2006
Posts: 4,742
Rep Power: 115
Lhotch is a glorious beacon of lightLhotch is a glorious beacon of lightLhotch is a glorious beacon of light
Default

Without knowing a little more I can only guess whats going on. Just trying to make sure we are on the same page.

When you say the "variables" are you using php variables in other php scripts or on template pages?

Are you assigning the php variables to smarty variables in your module?
__________________
Larry

What I post here should be used only as a guide to point you in the right direction. If the code I post doesnt make any sense or work as posted then you should spend more time reading the various manuals and tutorials so it does make sense and you can tweak it to work. A sure fire way to get yourself in trouble is to implement changes you dont have an intimate understanding of. Im happy to help, but I am not here to teach you to code or create your site for you.
Lhotch is offline   Reply With Quote
Old 01-19-2007, 01:20 PM   #7
The Master
 
Maffo's Avatar
 
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 46
Maffo is just really niceMaffo is just really nice
Default

Yes and no.

I have some global variables that I placed inside my init.php so I dont have to edit every page to call them. Some are php variables and some are assigned to smarty.

For example,

$testmaff="testmaff";
$class_tpl->assign('testmaff2', $testmaff);

I can use the php variable but the smarty isnt being parsed.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers.
Maffo is offline   Reply With Quote
Old 01-19-2007, 01:27 PM   #8
Coder
 
Join Date: Mar 2006
Posts: 4,742
Rep Power: 115
Lhotch is a glorious beacon of lightLhotch is a glorious beacon of lightLhotch is a glorious beacon of light
Default

Have you specified you want $class_tpl to be globally available? If not, then your smarty assignment will not work.

to do so, inside the function, right under the function specify class_tpl is global...ie

Code:
global $class_tpl;
__________________
Larry

What I post here should be used only as a guide to point you in the right direction. If the code I post doesnt make any sense or work as posted then you should spend more time reading the various manuals and tutorials so it does make sense and you can tweak it to work. A sure fire way to get yourself in trouble is to implement changes you dont have an intimate understanding of. Im happy to help, but I am not here to teach you to code or create your site for you.
Lhotch is offline   Reply With Quote
Old 01-19-2007, 01:38 PM   #9
The Master
 
Maffo's Avatar
 
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 46
Maffo is just really niceMaffo is just really nice
Default

Only part of my module is written as a function and this the hook part that interacts with each page. This element is working fine.

Leave it Larry, its friday after all.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers.
Maffo is offline   Reply With Quote
Old 01-19-2007, 04:21 PM   #10
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 2,224
Rep Power: 62
juven14 is a jewel in the rough
Default

Just a thought, how are you including these variables for global use? If you are including/defining these from mod_user.php which hook are you setting? I remember I had a problem with the start hook because it is loaded before the language hook.
__________________
John Snyder
PHP Developer
juven14 is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:01 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0