views static variables

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

views static variables

Postby Otto » Wed Nov 11, 2020 9:53 am

Dear Antonio,
Can you please help me to understand what I am doing wrong?

If I change a static variable in the router module, I don't see the change in the "VIEW" module.

But if I insert the code directly into the mod_harbour prg instead of VIEW, then everything fits.
What mistake am I making here?
Thank you in advance and best regards

Otto
I test with GENESIS.
Router function
...
cbreadcrumbneu := "***" + cbreadcrumbneu + "***"
return View( cRoute )

view( "body" )
...
<a id="title" class="navbar-brand mr-auto" style="color:white;padding-left:30px;">{{ breadcrumbs() }}</a>
...

function BuildEdit
...

cHtml += '{{ breadcrumbs() }}'
...


Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm

Re: views static variables

Postby Otto » Wed Nov 11, 2020 4:26 pm

Dear Antonio,
I'm sorry. I found my mistake.
I first query breadcrumbs before calling the router which sets the variable.
Best regards,
Otto

Code: Select all  Expand view

 <!-- Page Content  -->
  <div id="content">
     <img  src="./assets/img/winhotelqr.svg" width="300px"/>
     <p></p>
     <span style="font-size:30px;cursor:pointer" id="open" onclick="openNav()">&#9776; NAV open</span>
 
     <nav class="navbar navbar-expand-lg navbar-inverse" style="background-color:{{GetColor2()}};border:0px;">
      <a id="title" class="navbar-brand mr-auto" style="color:white;padding-left:30px;">{{ breadcrumbs() }}</a>

      {{ cRouteGesamt() }}      
     
      <div class="nav-item" style="color:white;display:inline-block;cursor:pointer;" onclick="Logout();">
         <a class="nav-link" style="color:white;" style="cursor:pointer;">{{GetUserName()}}
         <i class="fa fa-sign-out" style="padding-left:15px;"></i></a>
      </div>
   </nav>

     {{Router()}}

   </div>
   

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm

Re: views static variables

Postby Otto » Wed Nov 11, 2020 4:55 pm

Hello,
Using document.read and innerHTML helped.

Code: Select all  Expand view
<script>
      $(document).ready(function() {
         document.getElementById('title').innerHTML='{{ breadcrumbs() }}' ;
      });
</script>

---------------------------------------------------------------------------------------------------
In this context, I also googled the following question:

Can you have multiple $(document).ready(function(){ … }); sections?

You can have multiple ones, but it's not always the neatest thing to do. Try not to overuse them, as it will seriously affect readability. Other than that , it's perfectly legal.
https://stackoverflow.com/questions/132 ... n-sections

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6329
Joined: Fri Oct 07, 2005 7:07 pm

Re: views static variables

Postby Antonio Linares » Wed Nov 11, 2020 6:59 pm

Great

Thank you for sharing it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 7 guests

cron