Jump to content

@byte

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by @byte

  1. $config->prependTemplateFile = '_init.php'; $config->appendTemplateFile = '_main.php'; Thanks a lot, that did the Trick. Just deactivated it for the template.
  2. Thanks for the tipp. Got a problem with json_encode. The template Content-Type is set to application/json but i still get the html including the json array instead of just the json array as result. Are there any other settings i have to change in order to get just the json array returned?
  3. Changed my Code to that now <?php namespace ProcessWire; if($input->urlSegment(1) == 'rundgang'){ $kontrolleur = $sanitizer->text($input->post->kontrolleur); $gewaesser = $sanitizer->text($input->post->gewaesser); $start = $sanitizer->text($input->post->start); $ende = $sanitizer->text($input->post->ende); $statement = "INSERT INTO kontrundgang (kontrolleur, gewaesser, start, ende) VALUES (:kontrolleur, :gewaesser, :start, :ende)"; $query = $database->prepare($statement); $query->bindValue(':kontrolleur', $kontrolleur); $query->bindValue(':gewaesser', $gewaesser); $query->bindValue(':start', $start); $query->bindValue(':ende', $ende); try { $query->execute(); $response['result'] = 'Daten übertragen..'; $query->closeCursor(); } catch (\Exception $e) { $response['result'] = 'Fehler, bitte erneut übertragen!'; } echo json_encode($response); } ?>
  4. Sorry, deleted the Code. I am not using it in production, just on localhost. to test the Android-App.
  5. Well for now i can't do it with a page, because i can't get a Table-View. We will see wednesday, if we take your Module. I think it's a total different discussion then.
  6. For now (testing the app) the tables are my own. Later i want to manage the entry's from the Backend. Still don't know how exactly i am going to do this, but i am in contact with bernhard for a solution. The posted code is part of the template for a api-page "example.com/api/" and i send the data from the App with POST. Just changed it with $input->urlSegment(1), so i can take the Post mode out.
  7. Thanks for the Response. Right now i use somethin like this. It works, just thought there is a way in Processwire to do it more professional. Looked at the two modules and did not really understand how to solve my problem with them.
  8. Hallo, i need to access tables in the Processwire Database from a Android App to read, insert and update tables. Is it possible to write a api.php to accomplish that task?
  9. Hi, i am using $config->ajax to change only the content of a page. Now the above solution is not working anymore because the page is not reloaded, so the Event Listener is not loaded. Any Idee how to solve it?
  10. Thanks a lot dragan for your help. I had to change one part $pg = $pages->get("link_Link=$url");
  11. This is my code: <?php include("./includes/head.inc"); ?> <div class="col-10-12"> <div class="toptitle"><?php echo $page->title; ?></div> <div id="content" class="content"> <?php $n = 0; $tabStyle = "<style type='text/css'>"; foreach($page->link_Top_Kategorie as $kategorie) { $n++; if ($n == 1){ echo "<input id='tab{$n}' type='radio' name='tabs' class='inputtab' checked>\n"; $tabStyle .= "#tab{$n}:checked ~ .tabcontent #content{$n}"; } else { echo "<input id='tab{$n}' type='radio' name='tabs' class='inputtab'>\n"; $tabStyle .= ",#tab{$n}:checked ~ .tabcontent #content{$n}"; } echo "<label for='tab{$n}' class='labeltab'>{$kategorie->link_Kategorie}</label>\n"; } $tabStyle .= "{display: block;}</style>"; echo $tabStyle; ?> <div id="tabcontent" class="tabcontent"> <?php $n = 0; foreach($page->link_Top_Kategorie as $kategorie) { $n++; echo "<div id='content{$n}'><p>\n"; foreach($kategorie->link_Repeater as $content) { $image = $content->link_Thumb; echo "<table class='tablelist'><tbody>"; echo "<tr><td rowspan='3' class='tablelist_Image'><img src='{$image->url}' alt='{$image->description}' width='80' /></td>"; echo "<td class='tablelist_Name'><strong>{$content->link_Name}</strong></td></tr>"; echo "<tr><td class='tablelist_Content'>{$content->link_Content}</td></tr>"; echo "<tr><td class='tablelist_Name'><span style='float:left;width:49%;text-align:left;'><a href='{$content->link_Link}' target='_blank' rel='noreferrer noopener'>Link besuchen</a></span><span style='float:right;width:49%;text-align:right;'>{$content->link_Count} mal besucht</span></td></tr>"; echo "</tbody></table>"; } echo "</p></div>"; } ?> </div> </div> </div> </div> <?php include("./includes/foot.inc"); ?>
  12. I got a repeater for the tabs witch has another repeater with all the links and a field 'link_ Count'. I would like to use the last example. How does your code know witch one to change?
  13. I got a template that shows a linklist in tabs. I would like to increase a integer field by 1 when the user clicks on the link. Is it possible to get the value of that field and add 1 to it and save it to the database?
  14. Thanks for your reply. Works perfect.
  15. Hallo, on a page i got 9 fields for Tabs. How can i access the data like in the following example? The way i am trying it, guess what , doesn't work. Any suggestions? <?php for($i = 1; $i <= 9; $i++) { echo "<input id='tab{$i}' type='radio' name='tabs' class='inputtab'"; if($i == 1) echo " checked='checked'"; echo ">\n"; echo "<label for='tab{$i}' class='labeltab'>$page->Tab.$i</label>\n"; } ?> Same on the TabContent <?php for($i = 1; $i <= 9; $i++) { echo "<div id='content{$i}'>"; echo "<p>$page->TabContent.$i</p></div>"; } ?>
  16. Hi, instead of letting pw handel the error pages i want to use my own. I got one page handling all errors by switching $_SERVER['REDIRECT_STATUS']. But it looks like pw is allways handeling the error pages no matter if i am commenting it out in the htaccess. What do i have to write in the htaccess to use my own error page?
  17. The Statistik-Script is PHP-Web-Stat. I copyed all files to the root/stat/ now and it works. Thanks a lot for your quick replys. So if i want to include a file in a template from there it schould be include("../stat/config/tracking_code.php");
  18. Hi, i am new to processwire and trying to setup a simple homepage. I am allmost done with and it works god so far. Now i want to use a statistik-script on my page. I copyed all file to a subdir under site/templates/stat/. But i get no access to that subfolder under processwire to install the script. Also i need access to that script for counting and have the user set a opt-out cokkie. How can i get access to files in that subfolder? Thanks in advance for help!
×
×
  • Create New...