I found several entries in the forum, but thought i would post this as it helps me remember what i did, so far it looks to work for me just fine.
I wanted to hide some fields from groups, for example i had a text area that states if a listing has been activated by admin, i also wanted to add notes and not have these visible to the client when they viewed the ??????_view.php page..
i am new with php but after trying many ways, this looks to be the best for me and my limited understanding lol
The idea is this...
My table is called "listings"
I wanted to use the default template generated by AppGini for Admin users.
I then wanted to create an alternative view for other groups that had hidden fields in their view.
My groups are as follows:
1 = anonymous
2 = Admins
3 = Members
Step 1:
copy /templates/listings_templateDV.html 3 times and rename to create.....
/templates/1listings_templateDV.html
/templates/2listings_templateDV.html
/templates/3listings_templateDV.html
Step 2:
add this to the bootstrap.css file
Code: Select all
.hideb {
display: none !important;
margin-bottom: 15px;
}
Open listings_dml.php
Find
Code: Select all
// open the detail view template
Code: Select all
if($dvprint){
$templateCode = @file_get_contents('./templates/listings_templateDVP.html');
}else{
$templateCode = @file_get_contents('./templates/listings_templateDV.html');
}
Code: Select all
// open the detail view template
$memberInfo = getMemberInfo();
$template = $memberInfo['groupID'];
if ($template == 2){
//So If the user is admin, then continue as normal and display original template
if($dvprint){
$templateCode = @file_get_contents('./templates/listings_templateDVP.html');
}else{
$templateCode = @file_get_contents('./templates/listings_templateDV.html');
}
}
else {
// If the user is not admin then get the group number and prepend the template name with the group number
//If the group id = 3 then the below will load the template called ./templates/3listings_templateDV.html
if($dvprint){
$templateCode = @file_get_contents('./templates/'.$template.'listings_templateDVP.html');
}else{
$templateCode = @file_get_contents('./templates/'.$template.'listings_templateDV.html');
}
}
then open up the members template ( /templates/3listings_templateDV.html )
find the field you want to hide
Code: Select all
<div class="form-group">
Code: Select all
<div class="hideb">
it seems to work
Cheers
Carl