MyBB Community Forums

Full Version: extra Templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi All,
I can not find any documentation on this subject ( perhaps I have not searched correctly Confused ) I have produced a new php file and require to add a template to mybb to adjust how the code is displayed. so how do you link a template to a php file ?
eval("\$template = \"".$templates->get("template")."\";");
(2011-08-17, 06:03 PM)Malcolm. Wrote: [ -> ]
eval("\$template = \"".$templates->get("template")."\";");

Ok thanks
so where would be the best place to add this function
Function CdvW(PluNo) As String
Attribute CdvW.VB_UserMemId = 0
   On Error GoTo CdvW_Error

If Len(PluNo) = 13 Then PluNo = Left(PluNo, Len(PluNo) - 1)
If Len(PluNo) = 8 Then PluNo = Left(PluNo, Len(PluNo) - 1)
'chop off the check digit just to work on the proper number
PluLen = Len(PluNo)
'make sure there are only 7 & 12 digit numbers
If PluLen <> 12 And PluLen <> 7 Then
    'pad with zero's here !
    MsgBox "Incorrect EAN Code Input", vbCritical, "Critical Error"
    CdvW = PluNo
    'display the error and send the input from user back to the programe
    Exit Function
End If
For i = 1 To PluLen
    Select Case i
        Case 1, 3, 5, 7, 9, 11
            Pl = Val(Mid(PluNo, i, 1))
            ' turn the odd string value to numeric for processing
            OddPlu = OddPlu + Pl
        Case 2, 4, 6, 8, 10, 12
            Pl = Val(Mid(PluNo, i, 1))
            ' turn the even string value to numeric for processing
            EvenPlu = EvenPlu + Pl
        End Select
Next i
'added all the odd & even digits together respectively
Select Case PluLen
Case 7
        CdvX = OddPlu * 3
        ' multiply by 3
        CdvX = CdvX + EvenPlu
        ' add the even total
Case 12
        CdvX = EvenPlu * 3
        ' multiply by 3
        CdvX = CdvX + OddPlu
        ' add the odd total
End Select
'note the difference between 7 & 12 digit codes
CdvX = CdvX Mod 10
' take the remainder after a division by 10
CdvX = 10 - CdvX
' take the remainder from 10
If CdvX >= 10 Then CdvX = CdvX - 10
' test if the remainder was 0
CdvW = PluNo + Trim(Str(CdvX))
'return the full string to the programe

   On Error GoTo 0
   Exit Function

CdvW_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CdvW of Module Cdv"
End Function

I know the code is VB6 & I can convert it but to how do I include a file full of functions like this ?

for those who are not conversant with vb6 the above function returns the last digit of a 13 or 8 digit bar code
Your best option would be to add the functions to the plugin file. But if you wish to use a second file;

require_once(MYBB_ROOT."/path/to/file.php");
(2011-08-17, 06:56 PM)Malcolm. Wrote: [ -> ]Your best option would be to add the functions to the plugin file. But if you wish to use a second file;

require_once(MYBB_ROOT."/path/to/file.php");

so I get this right a bunch of functions become a plugin ? and are called in that way ?
Are you creating a plugin? Or an individual page?
(2011-08-17, 07:11 PM)JimR Wrote: [ -> ]
(2011-08-17, 06:56 PM)Malcolm. Wrote: [ -> ]Your best option would be to add the functions to the plugin file. But if you wish to use a second file;

require_once(MYBB_ROOT."/path/to/file.php");

so I get this right a bunch of functions become a plugin ? and are called in that way ?

http://wiki.mybb.com/index.php/Authoring_Plugins
(2011-08-17, 07:14 PM)Malcolm. Wrote: [ -> ]Are you creating a plugin? Or an individual page?

I guess the result will be an extra page or 2 but if it is more useful to add the functions to a plugin that will do ,,, I guess
(2011-08-17, 07:14 PM)pavemen Wrote: [ -> ]
(2011-08-17, 07:11 PM)JimR Wrote: [ -> ]
(2011-08-17, 06:56 PM)Malcolm. Wrote: [ -> ]Your best option would be to add the functions to the plugin file. But if you wish to use a second file;

require_once(MYBB_ROOT."/path/to/file.php");

so I get this right a bunch of functions become a plugin ? and are called in that way ?

http://wiki.mybb.com/index.php/Authoring_Plugins

thanks for the link .. but you know what I am trying to produce !Cool
(2011-08-17, 08:34 PM)JimR Wrote: [ -> ]thanks for the link .. but you know what I am trying to produce !Cool

i totally forgot about that system you need. good luck with that, it was not going to be very simple
(2011-08-17, 09:46 PM)pavemen Wrote: [ -> ]
(2011-08-17, 08:34 PM)JimR Wrote: [ -> ]thanks for the link .. but you know what I am trying to produce !Cool

i totally forgot about that system you need. good luck with that, it was not going to be very simple

the learning curve from legacy VB to php is big so any help is good perhaps you can give me an idea if this should be a plugin or loads of pages ?
Pages: 1 2