Jump to content

Zeka

Members
  • Posts

    1,065
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Zeka

  1. Hi, Horst and thank you for answer.
    For now i implement solution based on url segments. 
    <?php
    if($input->urlSegment1 == 'download') {
        if($input->urlSegment2) {
            $names = array();
            $urls = array();
            foreach ($page->diagnostic_referral_repeater as $referral) {
                foreach ($referral->diagnostic_referral_files as $file) {
                    array_push($names, $file->name);
                    array_push($urls, $file->filename);
                }
            }
            $key = array_search($input->urlSegment2, $names);
            if($key !== false) {
                wireSendFile($urls[$key]);
            } else {
                throw new Wire404Exception();
            }
        }
    } else if($input->urlSegment1) {
      // unknown URL segment, send a 404
      throw new Wire404Exception();
    }
    ?>
    
                                <?php foreach ($page->diagnostic_referral_repeater as $referral) { ?>
                                    <div class="diagnostic-referral">
                                        <div class="diagnostic-referral__box">
                                            <div class="diagnostic-referral__title">
                                                <?php echo $referral->diagnostic_referral_category->title; ?>
                                            </div>
                                            <?php echo $referral->render('diagnostic_referral_files', 'diagnostic-referral'); ?>
                                            <div class="diagnostic-referral__files">
                                                <?php foreach ($referral->diagnostic_referral_files as $file) { ?>
                                                    <div class="diagnostic-referral-file">
                                                        <a href="<?php echo $page->path.'download/'.$file->name; ?>" class="diagnostic-referral-file__link">
                                                            <div class="diagnostic-referral-file__icon">
                                                                <span class="icon-download"></span>
                                                            </div>
                                                            <div class="diagnostic-referral-file__title">
                                                                <?php echo $file->description; ?>
                                                            </div>
                                                        </a>
                                                    </div>
                                                <?php } ?>
                                            </div>
                                        </div>
                                    </div>
                                <?php } ?>
    

    Do you have any recommendation to improve it? 

    Thanks. 

    • Like 1
  2. Hi.

    I have file field on a page wich contain pdf files.

    As i understand in almost all modern browsers pdf files will be opened in it, but i need to force files download. 

    I can use "download" attribute, but it does not work in IE.

    Is there some build-in methods for that in PW.

    Thanks!

  3. After update to PW 3.0.15 everything works great, thanks to FileCompiler, but i found strange behavior for some translatable strings.
    I'm using delegate template approach, so my _done.php file contain this code
    <?php
        include("views/layout/head.inc");
        include("views/layout/header.inc");
        include("views/layout/headerline.inc");
        include("views/layout/breadcrumbs.inc");
    ?>
    
    <?php echo $content;?>
    
    <?php
        include("views/layout/footer.inc"); 
    ?>
    In footer.inc i have some strings that have to be translated.
    <?php echo __('FAX'); ?>
    Here comes unclear things for me.
    In backend i set translation for this string, but in frontend i still get untranslated string.
    And it heppens only for strings that are located in files that are included in _done.php. Translation for every translatable string in other template files that goes from delegate approach works.
    Also if i put some translatable sting to _done.php it also works.
     
    One thing more: only files that included to _done.php get compiled twice.
    You can see it on the screenshot.
    PdP0gyc.png
     
    In files that stored in FileCompiler/views/layout string 
     <?php echo __('PHYSICAL_ADRESS'); ?> 
    becomes
    <?php echo \ProcessWire\__('PHONE'); ?>
    but in files that stored in FileCompiler/site/tempales/view/layout its still 
    <?php echo __('PHYSICAL_ADRESS'); ?> 
    

    So i can not understand what is going on. Is it a bug, or am i missing something?

    Thanks
     
  4. Hi.

    I am having difficulty in creating a selector query.

    I have three types of pages: pathologies, diagnostics, and diagnostic categories.

    Diagnostics are related to pathologies and categories by page field.

    Pathologies:

    id: 1 | title: one

    id: 2 | title: two

    id: 3 | title: three

    Diagnostic Categories

    id: 10 | title: cattle

    id: 11 | title: pigs

    id: 12 | title: poulty

    Diagnostics:

    id: 45 | title: one | pathologies: 1,3 | diagnostic_category: 10,

    id: 46 | title: two | pathologies: 2,3 | diagnostic_category: 10, 11

    id: 47 | title: three | pathologies: 1,2,3 | diagnostic_category: 10, 12

    id: 48 | title: four | pathologies: 1,2 | diagnostic_category: 10

    I need to list pathologies that related to specific category.

    Example: 

    For pigs (id:11) category it will be pathologies with ids 2, 3.

    For poulty (id:12) category pathologies with ids 1, 2, 3.

    Is it possible to do with selectors? 

    Any help would be appreciated

  5. Hi guys,

    I'm trying to add some useful admin links to my page like preconfigured ListerPro pages, ProcessPageAdd links and so on.

    Is it possible to modify the ProcessPageList to only show pages with a specific template? I've already found a tutorial to modify the PageList to only show items of a specific parent (see here). The easiest way is probably to duplicate the module and modify it, right?

    Thanks!

    Nik

    Hi.

    To shop only pages for a specific tepmplate:

    Do all steps from link you pointed with some exception:

    set process option to ProcessPageLister and in ready.php put someting like 

    
    if($page->template=="admin" && $page->name=="your-page-name") {
        // the initial selector string that all further selections are filtered by
        // this selector string is not visible to user are MAY NOT be removed or changed,
        // except for 'sort' properties.
        $this->set('initSelector', 'template=sometemplate');    
    };
    ?>
    
  6. Hi. I am quite new to processwire and want to use it as an alternative to Joomla with seblod. I need some advise how i can implement editable list of items ( articles ). For example we have 20 products with different fields and prices field one of them.

    How can I display an editable list of the products displaying only some field from them.

    Here some screenshot:Editable%20List.png

×
×
  • Create New...