Buenos dias
Tengo el siguiente codigo:
{{ Css( 'app.css' ) }}
<?prg
#include {{ TWebInclude() }}
local aRows := pvalue(1)
DEFINE WEB oWeb TITLE 'Aperturas de Sucursales' TABLES INIT
DEFINE FORM o
INIT FORM o
ROW o
COL o GRID 12
DEFINE BROWSE oBrw ID 'ringo' HEIGHT 400 OF o
ADD oCol TO oBrw ID 'sucursal' HEADER 'ID' SORT
ADD oCol TO oBrw ID 'nombre' HEADER 'Nombre Sucursal' SORT
ADD oCol TO oBrw ID 'fecha' HEADER 'fecha' Sort
INIT BROWSE oBrw DATA aRows
END o
END o
END FORM o RETURN
?>
Pero este se ejecuta y pone en toda una ventana, mi pregunta:
Como puedo poner un header, un nav y un menu ? En que parte de este codigo entrarían ?
Mi idea es que simpre que el usuario presione algúna opción del menu, y que sea un BROWSE, este se muestre como parte de.
DEFINE WEB <= Hace 1.- <html><head><body> y nav. aqui es donde queiro meter todo mi propio head y nav.
Espero no hacerlos bolas.
Saludos
Osvaldo Ramirez
Tweb/TMercury
- ricardo arraes
- Mensajes: 87
- Registered for: 3 years 5 months
Hey Osvaldo!
I already did something like that once, let me show you what I did:
First of all, I got a "main" view, which is going to be loaded everytime, I call it "home.view":
as you can see:
-I got a "menu.view" which is going to be the browser you just mentioned.
-I got the "footer.view" which is the footer you just mentioned
-I got the "barrasuperior.view" which is the header you just mentioned
and the <prg> inside of the "Home.view" is going to load the HTML code that I desire, using this kind of strategy:
I created my router like that:
These methods from my controller.prg will "redirect" my application in order to create the HTML code that I desire, like this:
So the "redirecionar" method will be in charge of managing these requests and creating the HTML content:
And that's it...
hope it helps you!
I already did something like that once, let me show you what I did:
First of all, I got a "main" view, which is going to be loaded everytime, I call it "home.view":
Código: Seleccionar todo
{{View('header.view')}}
<link href="/css/dashboard.css" rel="stylesheet">
</head>
<body>
{{View('barrasuperior.view')}}
<div class="container-fluid">
<div class="row">
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4">
{{View('menu.view')}}
<?prg
cHtml := App():get("chtml")
RETURN cHtml
?>
</main>
</div>
</div>
</body>
{{View('scripts.view')}}
<script src="/js/vfatec.js"></script>
{{View('footer.view')}}
-I got a "menu.view" which is going to be the browser you just mentioned.
-I got the "footer.view" which is the footer you just mentioned
-I got the "barrasuperior.view" which is the header you just mentioned
and the <prg> inside of the "Home.view" is going to load the HTML code that I desire, using this kind of strategy:
I created my router like that:
Código: Seleccionar todo
DEFINE APP oApp TITLE 'teste';
ON INIT Config() ;
CREDENTIALS 'teste' COOKIE 'teste'
DEFINE ROUTE 'root' URL '/' CONTROLLER 'inicio@controller.prg' METHOD 'GET' OF oApp
DEFINE ROUTE 'rota1' URL 'rota1' CONTROLLER 'rota1@controller.prg' METHOD 'GET' OF oApp
DEFINE ROUTE 'rota2' URL 'rota2' CONTROLLER 'rota2@controller.prg' METHOD 'GET' OF oApp
DEFINE ROUTE 'rota3' URL 'rota3' CONTROLLER 'rota3@controller.prg' METHOD 'GET' OF oApp
INIT APP oApp
These methods from my controller.prg will "redirect" my application in order to create the HTML code that I desire, like this:
Código: Seleccionar todo
METHOD inicio(oController) CLASS Controller
::redirecionar(oController,"I")
RETURN NIL
METHOD rota1(oController) CLASS Controller
::redirecionar(oController,"A")
RETURN NIL
METHOD rota2(oController) CLASS Controller
::redirecionar(oController,"B")
RETURN NIL
METHOD rota3(oController) CLASS Controller
::redirecionar(oController,"C")
RETURN NIL
Código: Seleccionar todo
METHOD redirecionar(oController,cdir,cHtml_,cAtt) CLASS Controller
LOCAL oValidator := TValidator():New()
LOCAL hRoles := {=>}
LOCAL cView, wcesp:="", cHtml:="", wcpaci:="", wnomepac:="",wpag:="1"
DO CASE
CASE cdir="I"
cHtml := ::getInicio(oController)
CASE cdir="A"
cHtml := ::getrota(oController,1)
CASE cdir="B"
cHtml := ::getrota(oController,2)
CASE cdir="C"
cHtml := ::getrota(oController,3)
ENDCASE
IF Empty(cHtml)
cHtml:=cHtml_
ENDIF
App():Set("chtml",cHtml)
oController:View("home.view")
RETURN NIL
Código: Seleccionar todo
METHOD getInicio(oController)
LOCAL cHtml:=""
cHtml+='<h3 style="margin-top:2rem">Orientações sobre a plataforma</h3>'+;
'<div class="border" style="padding: 1rem">'+;
'<h5 style="margin-top:0.5rem">teste inicio</h5>'+;
'</div>'
RETURN cHtml
METHOD getInicio(oController)
LOCAL cHtml:=""
cHtml+='<h3 style="margin-top:2rem">Orientações sobre a plataforma</h3>'+;
'<div class="border" style="padding: 1rem">'+;
'<h5 style="margin-top:0.5rem">teste inicio</h5>'+;
'</div>'
RETURN cHtml
METHOD getrota(oController,nrota)
LOCAL cHtml:=""
cHtml+='<h3 style="margin-top:2rem">Orientações sobre a plataforma</h3>'+;
'<div class="border" style="padding: 1rem">'+;
'<h5 style="margin-top:0.5rem">teste rota '+hb_valtostr(nrota)+'</h5>'+;
'</div>'
RETURN cHtml
And that's it...
hope it helps you!
The work always comes before the belief
-
- Mensajes: 127
- Registered for: 3 years 5 months
Thanks Ricardo
Let me read and try to understand...
I will post some my advanced
Regards
Osvaldo Ramirez
Let me read and try to understand...
I will post some my advanced
Regards
Osvaldo Ramirez