Antonio Linares wrote:Marc,
PHP is NOT needed at all. We only use Harbour PRG code !!!
thats the beauty of it
1. Have you installed Apache on your Windows or Xampp on your Windows ?
2. Have you properly installed mod_harbour ?
Please read this and follow the steps:
viewtopic.php?p=223785#p223785
function BuildBrowse( cTableName )
local cHtml := "", n, nRow := 0
USE ( hb_GetEnv( "PRGPATH" ) + "/data/" + cTableName ) SHARED NEW
if ! Empty( GetAction() ) .and. GetAction() == "add"
APPEND BLANK
GO TOP
endif
if ! Empty( GetAction() ) .and. GetAction() == "del"
USE
USE ( hb_GetEnv( "PRGPATH" ) + "/data/" + cTableName ) NEW
DbGoTo( GetVal1() )
DELETE
PACK
USE
USE ( hb_GetEnv( "PRGPATH" ) + "/data/" + cTableName ) SHARED NEW
GO TOP
endif
if ! Empty( GetAction() ) .and. GetAction() == "search"
SET FILTER TO Upper( GetParam1() ) $ Upper( DBRECORDINFO( 7 ) )
GO TOP
nVal1 = 20
endif
if GetVal2() != 0
DbSkip( GetVal2() )
endif
cHtml += '<table id="browse" class="table table-striped table-hover;"">' + CRLF
cHtml += '<thead>' + CRLF
cHtml += '<tr>' + CRLF
cHtml += '<th scope="col">#</th>' + CRLF
for n = 1 to FCount()
cHtml += '<th scope="col">' + FieldName( n ) + '</th>' + CRLF
next
cHtml += '<th scope="col">ACTIONS</th>' + CRLF
cHtml += '</tr>' + CRLF
cHtml += '</thead>' + CRLF
cHtml += '<tbody>' + CRLF
while ! Eof() .and. nRow < GetVal1()
cHtml += "<tr>" + CRLF
cHtml += '<th scope="row">' + AllTrim( Str( RecNo() ) ) + "</th>" + CRLF
for n = 1 to FCount()
do case
case FieldType( n ) == "M"
cHtml += '<td>' + If( "</" $ FieldGet( n ), "...", SubStr( FieldGet( n ), 1, 20 ) ) + CRLF
if ! "</" $ FieldGet( n )
cHtml += '<button onclick="MsgInfo(' + "'" + ;
StrTran( FieldGet( n ), Chr( 13 ) + Chr( 10 ), "<br>" ) + "', '" + ;
FieldName( n ) + "');" + '"' + ;
' type="button" class="btn btn-primary"' + CRLF
cHtml += ' style="border-color:gray;color:gray;background-color:#f9f9f9;">' + CRLF
cHtml += '<i class="fas fa-eye"' + ;
' style="color:gray;padding-right:15px;font-size:16px;">' + CRLF
cHtml += '</i>View</button>' + CRLF
endif
if FieldName( n ) == "CODE"
cHtml += '<button onclick="location.href=' + "'index.prg?" + Lower( Alias() ) + ":exec:" + ;
AllTrim( Str( RecNo() ) ) + "';" + ;
'" type="button" class="btn btn-primary"' + CRLF
cHtml += ' style="border-color:gray;color:gray;background-color:#f9f9f9;">' + CRLF
cHtml += '<i class="fas fa-flash"' + ;
'style="color:gray;padding-right:15px;font-size:16px;">' + CRLF
cHtml += '</i>Exec</button>' + "</td>" + CRLF
else
cHtml += "</td>" + CRLF
endif
case FieldType( n ) == "L"
cHtml += '<td><input type="checkbox" onclick="return false;"' + ;
If( FieldGet( n ), "checked", "" ) + "></td>" + CRLF
otherwise
cHtml += '<td>' + ValToChar( FieldGet( n ) ) + "</td>" + CRLF
if FieldType( n ) == "C" .and. "." $ FieldGet( n )
// if File( hb_GetEnv( "PRGPATH" ) + FieldGet( n ) )
cHtml += '<td><img src="' + hb_GetEnv( "DOCUMENT_ROOT" ) + ;
AllTrim( FieldGet( n ) ) + ;
'" style="width:50px;border-radius:50%;"></td>' + CRLF
// endif
endif
endcase
next
cHtml += '<td>' + CRLF
cHtml += '<button onclick="Edit(' + AllTrim( Str( RecNo() ) ) + ');"' + ;
' type="button" class="btn btn-primary"' + CRLF
cHtml += ' style="border-color:gray;color:gray;background-color:#f9f9f9;">' + CRLF
cHtml += '<i class="fas fa-edit" style="color:gray;padding-right:15px;font-size:16px;">' + CRLF
cHtml += '</i>Edit</button>' + CRLF
cHtml += '<button onclick="Delete(' + AllTrim( Str( RecNo() ) ) + ');"' + ;
' type="button" class="btn btn-primary"' + CRLF
cHtml += ' style="border-color:gray;color:gray;background-color:#f9f9f9;">' + CRLF
cHtml += '<i class="fas fa-trash" style="color:gray;padding-right:15px;font-size:16px;">' + CRLF
cHtml += '</i>Delete</button>' + CRLF
cHtml += '</td>' + CRLF
SKIP
nRow++
end
cHtml += '</tbody>' + CRLF
cHtml += '</table>' + CRLF
cHtml += "<hr>" + CRLF
cHtml += '<div class="row" style="padding-left:15px">' + CRLF
cHtml += '<div class="col-sm-3">' + CRLF
cHtml += "Showing records " + AllTrim( Str( Max( GetVal2() + 1, 1 ) ) ) + " - " + ;
AllTrim( Str( RecNo() - 1 ) ) + " / Total: " + AllTrim( Str( RecCount() ) ) + "</div>" + CRLF
cHtml += '<div class="col-sm-1"></div>' + CRLF
if RecCount() > nRow
cHtml += '<div class="col-sm-3 btn-group" style="height:50px;">' + CRLF
cHtml += ' <button onclick="' + "location.href='index.prg?" + GetContent() + ":browse:' + GetRowsPerPage() + ':" + ;
AllTrim( Str( 0 ) ) + "'" + '" type="button" class="btn btn-primary" style="background-color:{{GetColor1()}};">' + ;
'<i class="fas fa-angle-double-left" style="color:white;padding-right:15px;font-size:18px;"></i>First</button>' + CRLF
cHtml += ' <button onclick="' + "location.href='index.prg?" + GetContent() + ":browse:' + GetRowsPerPage() + ':" + ;
AllTrim( Str( RecNo() - 41 ) ) + "'" + '" type="button" class="btn btn-primary" style="background-color:{{GetColor2()}};">' + ;
'<i class="fas fa-angle-left" style="color:white;padding-right:15px;font-size:18px;"></i>Prev</button>' + CRLF
cHtml += ' <button onclick="' + "location.href='index.prg?" + GetContent() + ":browse:' + GetRowsPerPage() + ':" + ;
AllTrim( Str( RecNo() - 1 ) ) + "'" + '" type="button" class="btn btn-primary" style="background-color:{{GetColor2()}};">Next' + ;
'<i class="fas fa-angle-right" style="color:white;padding-left:15px;font-size:18px;"></i></button>' + CRLF
cHtml += ' <button onclick="' + "location.href='index.prg?" + GetContent() + ":browse:' + GetRowsPerPage() + ':" + ;
AllTrim( Str( RecCount() - 20 ) ) + "'" + '" type="button" class="btn btn-primary" style="background-color:{{GetColor1()}};">Last' + ;
'<i class="fas fa-angle-double-right" style="color:white;padding-left:15px;font-size:18px;"></i></button>' + CRLF
cHtml += '</div>' + CRLF
endif
cHtml += "</div>" + CRLF + "</div>" + CRLF + "</div>" + CRLF
USE
return cHtml
Marc Venken wrote:...I can do it in php, but looking for a sample from Harbour. (the index.prg sample is using also PHP) but maybe I'm missing parts of way Mod is working.
cnavarro wrote:Marc Venken wrote:...I can do it in php, but looking for a sample from Harbour. (the index.prg sample is using also PHP) but maybe I'm missing parts of way Mod is working.
Sorry, what is the index.prg file that php uses?
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 38 guests