Jump to content

Search the Community

Showing results for tags 'include'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 18 results

  1. Hi! I want to make a small site, a one page site. And i have this idea about doing 2 to 3 diffrent template that i can load into the index / home page. I want to do this with an array so that i can keep creating more topics (with the template) id needed. <?php include('./head.inc'); // include header markup ?> <?php $children = $page->get('template=onecolmn|twocolumn, sort=sort'); foreach($children as $child) { include($child); } ?> <?php include('./foot.inc'); // include footer markup ?> As you can see i have to template wish i want to control from the backend. I know include does not work this way, put what is my other option to make an array that loads the whole page on an other pages.
  2. Hi fellow developers! I want to implement following action: Admin-priviledged user uploads a spreadsheet file (with many sheets) When page is saved, back end generates repeater items from the sheets We can render spreadsheet data from the repeater field. Profit! Currently I'm trying to find a way to read the uploaded spreadsheet file. ProcessWire doesn't seem to have modules suitable for my needs, but external PHP Library PhpSpreadsheet sounds like it could do the job. However, I can't even try it, because I simply don't understand how I can refer to an external library! Folder structure: templates _func.php > where I want to refer to the library libraries PhpSpreadsheet bunch of *.php > what I want to refer to I have tried different things varying from their documentation to forum posts and PW API with no luck. I would prefer not to use Composer, since it seems kind of overkill for one library. Thanks in advance and have a great day!
  3. Hi there Basically I want to call code within a ProcessWire page that isn't used as a template. Example: www.mypwpage.com/myphpfile.php I have a working PW Website with a couple of pages like /artists, /releases, /videos etc. Now I need a page /download without any editable fields in the backend, just calling some PHP code (that was coded by another guy) containing a form that checks unique download-codes in a second database and starts the download of the desired file. The script is working fine right now as part of a static website, but since I built PW behind the site, this independent «Download Section» of the page doesn't work anymore. Right now I have the main file download.php as a page template on a newly created empty page called /download, so until now the form is working (wow). After sending the form containing the download-code, the file check_code.php in a subfolder /site/templates/download is called and that's where I get an error. Any help?
  4. Hey everyone, hope you're all doing well! I'm building my first ProcessWire website at the moment, which is of course a very good way to understand all of the possibilities ProcessWire has to offer. But that also means that I'm facing some troubles now and then, and so is the case right now. I made a template for a couple of pages, like the homepage, the contact page, etc. I am using Bootstrap 4.0 for the layout. So here's the deal: I want to show an alert box on top of every page, warning the user that the website is still under construction. Of course, I can just include the code and add the fields I made for the alert into the template, but that means I have to do that for every page, which I obviously don't want. So I made a template with the code and fields for the alert. When I did this, I realised that I can create multiple alerts this way, so I made two pages, containing different alerts. (And converted the code into a foreach-loop in the template). But now my question; how can I include these pages in a different template? Can I make a field or something to insert a page or is this simply not possible? Or do I have to approach this in a different way? I hope I explained my problem clear! Thank you in advance, matsn0w
  5. I'm trying to build a multilanguage website with Turkish as main and English as alternative language. I replaced hardcoded strings in template files and used built-in translation tools to translate template files. I'm using the functions ProcessWire provides: // using __() <?= __("There are no products to display.") ?> // or _x() <html lang="<?= echo _x('en', 'HTML language code'); ?>"> // Both works when I use _main.php When I disable auto including _main.php from config.php file, and move or rename _main.php to something else or use another file (other than _main.php that comes with site-languages profile) for template specific markups, say markup/products.php like below, translations stop working. // config.php, disabled auto append // $config->appendTemplateFile = '_main.php'; // home.php include_once("./_main.php"); wireIncludeFile("./_main.php"); // TRANSLATION WORKS include_once("./_home.php"); // DOESNT WORK wireIncludeFile("markup/_main.php"); include_once("markup/_main.php"); // DOESNT WORK // NOTE: home.php and main.php has the same content, same permissions, same ownership I debugged the issue, and the reason, as ridiculous as it sounds, originates from using file other than _main.php. I searched the forums, google, but this seems like a unique issue. Is there anything I'm missing and how can I fix this, because I can't think of anything else after hours lost trying to find the underlying cause? Thanks in advance.
  6. I have one central website, with membership registration and content etc., and then several related websites with their own URL/domains, each on Processwire, all on the same server. I would like to access the database of the central website from the sister websites. How would I do that? You can't bootstrap one PW installation into another. You can include template parts from one in the other by just using the server path, but whatever you try to get/post just comes/goes to the database of the site you are on. Could you switch databases by including the config.php from another PW installation somewhere? What is the correct, secure way to do this?
  7. I am using ProcessWire as the back-end to manage contents on multiple sites (I call them "sub-domains"). I use ProcessWire as an editing system and database only. The ProcessWire templating system is not in use. I want to use ProcessWire's API and in particular the Include & Bootstrap method to output contents -- pretty much in the same way you do, if contents is stored in a MySQL database and output in PHP files that use PDO to load data. The issue is that I cannot get ProcessWire to fully work on each of the "sub-domains". https://processwire.com/api/include/ says: > You can do anything with ProcessWire's API that you can do from a template, > so all of this still applies, as does everything in the developer API. How can I get access to variables such as $input when using Include & Bootstrap? I tried these: $wire->pages->get("/foo/bar/"); echo "Segment1: " . $wire->input->urlSegment1; # Returns null $wire->pages->get("/foo/bar/"); echo "Segment1: " . $wire->input()->urlSegment1; # Internal Server Error $p = $wire->pages->get("/foo/bar/"); echo "Segment1: " . $p->input->urlSegment1; # Returns null $p = $wire->pages->get("/foo/bar/"); echo "Segment1: " . $p->input()->urlSegment1; # Returns null @ryan Can the API Variables documentation be updated with a section / an example that explain how to use "Include & Bootstrap" for each variable (since this is a really strong feature in ProcessWire)? $page $pages - Example: $homepage = $wire->pages->get("/"); $input $sanitizer $session $fields $user $log $templates $config
  8. Noob to Processwire. Trying to convert some older sites to Pwire. I am having trouble including a legacy form class into my templates: If I embed the php directly in the template, it works. But if I use include statements, the form object returns null. This works: use formbuild\Form; session_start(); $form = new Form(init1, 'init2', ...'); $form->param1 = ...; $form->param2 = ...; $form->param3 = ...; $form->render(); ----------------------------------------------------------------------------------------- This fails: include_once ($config->paths->templates."forms/form1.php"); $form->render(); ____________________________________________________________________ My referencing is OK, no error message. The only code that cannot reside in the include file are the following lines: use formbuild\Form; $form = new Form(init1, 'init2', ...'); My PhP is rusty, maybe that is the problem, but it could be something about Pwire, namespace maybe. I have tested it outside Pwire and no problems. Please advise. Thanks.
  9. So I was working on a module and trying to include a library (so I could use it across the site) using $modules->get('myModule'); . However, When I go to include the library folder (modeled after the LibFlourish module created some time ago). I keep getting: site/modules/MyModule/libraryName/ProcessWire\filetoinclude.php This comes with an error notifying that "failed to open stream: No such file or directory in ...".. Is ProcessWire supposed to be in the include url, or is there a way around this? Sorry, I am quite new to working with my own modules. I just noticed the sub forum regarding Development, if someone could move this to the correct area I would appreciate it.
  10. Hi, I need to separate the header, footer and sidebar from the _main.php file. I've tried all of the following without success: <?php include ("header.php"); ?> <?php include ("/_header.php"); ?> <?php include ("./header.inc"); ?> <?php $header = pages()->get('/rcl-header.php'); // include header echo $header; ?> Any guidance would be appreciated.
  11. I'm trying to use "PHPMailerAutoload" class with Processwire. When I include class "include_once("./PHPMailerAutoload.php");" and call it in my code "$mail = new PHPMailer();" i get an error: <p style='background:crimson;color:white;padding:0.5em;font-family:sans-serif;'><b>Error: Class 'ProcessWire\PHPMailer' not found (line 24 of /Applications/MAMP/htdocs/vm-pw-react/server/site/templates/contact.php) </b><br /><br /><small>This error message was shown because: you are logged in as a Superuser. Error has been logged. </small></p> How do I load and use the class?
  12. I'm moving a client site to PW. They've been using Dreamweaver for years and want to continue to use Dreamweaver for some elements of their site. One of these elements is a pretty complex order form (webform.php) I was considering the following A normal PW page called order would have a body field. Within this, I'd call a HannaCode called [[get-webform]] within the code of the hanna code, I'd call that webform.php as an include That'd mean the client can FTP up any changes to include/webform.php and therefore bypass PW a little for this particular element. I know an alternative would be to include the webform.php directly in the template but was wondering if above approach might work too? I've actually tried it already and am getting no output from the HC. Warning: include(/includes/webform.php): failed to open stream: No such file or directory in /var/www/vhosts/site.com/httpdocs/site/assets/cache/HannaCode/webform.php on line 3 Warning: include(): Failed opening '/includes/webform' for inclusion (include_path='.:') in /var/www/vhosts/site.com/httpdocs/site/assets/cache/HannaCode/webform.php on line 3 webform.php does exist on the server and my other includes work just fine. Some of those other includes contain PHP selectors etc.
  13. Hi folks! In my current project I'm using ProcessWire v2.5 as pure backend service, including it in my frontend application as described here. Now I encountered some problems with the pw session handling interfering with the session handling of my frontend application. In this case the pw installation runs on a subdomain of my frontend application. Duplicate session_start() Each time I include pw's index.php pw tries to start it's own session, resulting in a notice that a session has already been started. To encounter this problem, I changed one row in Session::___init() (/ProcessWire/wire/core/Session.php): protected function ___init() { if (session_status() != PHP_SESSION_ACTIVE) @session_start(); } Session configuration override Additionally pw sets it's own session configuration and therefore overrides the config of my frontend application. To prevent this, I wrapped the session configuration block within the index.php (/ProcessWire/index.php, rows ~176ff) in a condition: if (session_status() != PHP_SESSION_ACTIVE) { session_name($config->sessionName); ini_set('session.use_cookies', true); ini_set('session.use_only_cookies', 1); ini_set('session.cookie_httponly', 1); ini_set('session.gc_maxlifetime', $config->sessionExpireSeconds); if (ini_get('session.save_handler') == 'files') { if (ini_get('session.gc_probability') == 0) { // Some debian distros replace PHP's gc without fully implementing it, // which results in broken garbage collection if the save_path is set. // As a result, we avoid setting the save_path when this is detected. } else { ini_set("session.save_path", rtrim($config->paths->sessions, '/')); } } } This is surely a bad way to fix my problem, because I had to change some code within the pw core. If anybody knows a more elegant solution to prevent pw from starting/configuring a session if used vi include, it would be very welcome. regards, Wumbo
  14. I run php -a so I have an interactive shell to work with. I've tried to include('./index.php'); per the instructions at https://processwire.com/api/include/ but I get the following error: Fatal error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in /.../wire/core/WireDatabasePDO.php on line 83. Any ideas? Will it just not work in the interactive shell?
  15. Hello, I'm working with the include& bootstrap API in order to include content from a different PW installation in my main website. It seems to work correctly, but sometimes (once per week) the page doesn't receive data from processwire (All the images and text are not showing) The only way I found to solve this is... login to the processwire admin page. Instantly the API starts to work again. This is the code I use: <?php function listPage($page, $level = 0) { if($page->numChildren) { foreach($page->children as $child) { ?> <div class="6u"> <div class="row"> <div class="6u box240 boxtext bg-color-events"> <h3><?php echo $child->title ?></h3> <p><?php echo $child->summary ?></p> <a class="scopri color-events" href="eventi?detail=<?php echo $child->name ?>"><span>scopri</span></a> </div> <a href="eventi?detail=<?php echo $child->name ?>"> <div class="6u box240 imghover color-events"> <?php $cover = $child->cover->first(); ?> <img src="/news<?php echo $cover->url;?>" alt="Vai al dettaglio dell'evento"> </div> </a> </div> </div> <?php } } }?> ..... <?php { listPage($wire->pages->get("/eventi/")); } ?> Did it ever happen to you? Any ideas about the possible cause?
  16. Hello everyone, I'm new here but I'm really looking forward to using this amazing tool to help me complete a new project. I am currently developing a site using a web based database named Omeka for a local art gallery. They have thousands of works available in their archives and their current non dynamic website is no longer able to keep up with its content. The cms that will be handling all of the content is amazing for dealing with objects and their associated metadata, but when it comes to its ability to create custom content it just doesn't have enough tools. So after much searching I came upon processwire, and I am really excited. So here is what I am hoping to achieve. Omeka handles the objects. Processwire handles the pages within the site that need to be curated. So what I currently have is several views that include in the body of the website that are pointed to paths in processwire’s directories and an iframe in my admin panel that points to processwire’s admin panel to create the feeling of a plugin. Where I am now struggling is how I should approach hiding the view’s path from the web, but still allowing them to be included in the rest of the project. Thank you in advance!
  17. The title of this thread isn’t very precise (or correct), sorry for that. Also: possibly this is the wrong section of the forum. I think this is a more general PHP programming question, that’s why I put it here. I have a module that triggers a function after a page is saved in the backend. That function includes a file from a folder in the same directory. After the include I want to trigger a function from the included file. So the basic setup is this: <?php class MyAwesomeModule extends WireData implements Module { … public function init() { $this->pages->addHookAfter( "save", $this, "myFunction" ); } public function myFunction( $event ) { … include "inc/file.inc"; functionFromIncludedFile(…); } … public function bla1(…) { … } } The file.inc file uses functions, that are declared in the module file, like so: <?php function functionFromIncludedFile() { … $var = $this->bla1(…); … } After saving a file I get "Using $this when not in object context" error. I know why the error occurs, but I don’t know how to solve my problem. Obviously, changing $var = $this->bla1(…); to $var = bla1(…); generates a "Call to undefined function bla1()" error. I guess this is easily solvable, thanks for any help.
  18. Hello, First of all, i like Processwire very much! Here's my question. How can i create a footer in Processwire that resembles my attached image. The user must have the possibility to change the blocks in the footer (title, text) and the footer is included, so the changes are shown across the complete site. - i would like to have a seperate section for generic block, so i could create an extra menu item in the backend, besides pages, called "generic blocks"? - or do i have to simple create a page and attach it to a template called footer and not make it visible in the menu? Anyways, could somebody tell me the best practice? Maybe this is already dicussed in the forum, i couldn't find it, but if so, please redirect me. Thanks in advance!
×
×
  • Create New...