Page 1 of 1

views static variables

Posted: Wed Nov 11, 2020 9:53 am
by Otto
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

Re: views static variables

Posted: Wed Nov 11, 2020 4:26 pm
by Otto
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

 <!-- 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>
   

 

Re: views static variables

Posted: Wed Nov 11, 2020 4:55 pm
by Otto
Hello,
Using document.read and innerHTML helped.

Code: Select all

 <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

Re: views static variables

Posted: Wed Nov 11, 2020 6:59 pm
by Antonio Linares
Great

Thank you for sharing it