Jump to content

fisnik

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by fisnik

  1. On 2/17/2022 at 3:22 PM, maetmar said:

    Hello,

    I would appreciate if someone could help solving the problem I have. I tried to find some code examples that might solve my issue, but have not been succesfull so far.

    The HTML I need to render is the following below. I manage to get all done, except I have no clue how I can have a different class ("other_class") for the "a" tag in the 2nd level of the menu.

    Any help is welcome.

    thanks

    <ul class="navbar-nav">
          <li class="nav-item"><a class="nav-link" href="#">Menu A</a> </li>
          <li class="nav-item dropdown"><a class="nav-link dropdown-toggle" href="#">Menu B</a>
                <ul class="dropdown-menu">
                     <li class="nav-item"><a class="other_class" href="#">Subitem of Menu B</a></li>
                  </ul>
          </li>
      </ul>

    I do stuff like this using hooks, have a look it may be useful to you in many cases

    $nav = $modules->get("MarkupSimpleNavigation"); // load the module    

    i added this hook after menu options

    $nav->addHookAfter("getTagsString", null, 
    
    function($event){
        $item = $event->arguments('page');
    
        // first level items need additional attr
        if($item->numChildren(true) && count($item->parents) < 2 && $item->id != 1){
            $title = $item->get("title|name");
            $event->return = '<a href="#" class="dropdown-item dropdown-toggle">' . $title . '</a>';
        }
    
        // submenus don't need class and data attribs
        if( //$item->numChildren(true) &&
    		count($item->parents) > 1){
            $event->return = '<a href="' . $item->url . '">' . $item->get("title|name") . '</a>';
       }
    }
    
    );

    It may be useful to you

  2. Hi @adrian i hope you are doing well. I have managed to migrate multi language posts with a help from a friend.
    What i just found out is that this module is not importing "featured image" from wordpress, it is importing only images that are embed on body. Is this right or did i miss something? Is there an easy way to fix this since it is very important?

    FYI: wordpress exporter by default it does not extrcat that image in .xml file, i did use this plugin to do that.
    https://wordpress.org/plugins/export-media-with-selected-content/

  3. @adrian Thanks a lot for info. I will try to do something and if it works i will share the info. Regarding usage usually myself when there is not too much content i copy it directly, i think this is the case for others too. But in cases like this one that i have now, we need modules like this i have to move 1000+ posts.

    I have to say that this module is life saver and very easy/simple to use, it does the job perfectly.

     

  4. Hi,

    I am trying to import to processwire a wordpress site with multi language. I have installed Processmigrator and MigratorWordpress(also in processwire multi laguage support is installed and fields have been change to support multi language). I have exported content(posts) from wordpress and successfully migrated to processwire. Currently both language posts are showing up as different pages.

    Can someone point me to right direction is there a way to migrate these posts into one or when i start importing from wordpress what should i do to have them imported in multilanguage?

     

    Thanks in advance,

  5. Hi,

    How can i add <a> class to first level of a href, excactly like in this example below, that class should not be added to all <a>.

    Also how can i make a link Not clickable for those who have chlidrens? Currently to hide some menus i am using 'selector' => 'navhide!=1, template!=sitemap'. But is there a way where i can assign a field to parent template not to have dropdown, and how to do that?

    Thank you

    P.s i have read documentation but i dint find a way to achieve this

     

    								<ul class="main-menu">
    									<li class="main-menu__item main-menu__item--has-child main-menu__item--active"><a class="main-menu__link" href="javascript:void(0);"><span>Home</span></a>
    										<!-- sub menu start-->
    										<ul class="main-menu__sub-list">
    											<li class="item--active"><a href="index.html"><span>01 Home Color Style</span></a></li>
    											<li><a href="front_2.html"> <span>02 Home Color Style</span></a></li>
    											<li><a href="front_3.html"><span>03 Home Color Style</span></a></li>
    											<li><a href="mono/index.html"><span>04 Home Monochrome</span></a></li>
    											<li><a href="mono/front_2.html"><span>05 Home Monochrome</span></a></li>
    											<li><a href="mono/front_3.html"><span>06 Home Monochrome</span></a></li>
    										</ul>
    										<!-- sub menu end-->
    									</li>
    </ul>

    My menu configuration is like this:

    $options = array(
        'parent_class' => 'parent',
        'current_class' => 'item--active',
        'has_children_class' => 'main-menu__item--has-child',
        'levels' => true,
        'levels_prefix' => 'level-',
        'max_levels' => null,
        'firstlast' => false,
        'collapsed' => false,
        'show_root' => false,
        'selector' => 'navhide!=1, template!=sitemap',
        'selector_field' => 'nav_selector',
        'outer_tpl' => '<ul class="main-menu">||</ul>',
        'inner_tpl' => '<ul class="main-menu__sub-list">||</ul>',
        'list_tpl' => '<li%s>||</li>',
        'list_field_class' => 'main-menu__item {title}',
        'item_tpl' => '<a href="{url}"><span>{title}</span></a>',
        'item_current_tpl' => '<a href="{url}">{title}</a>',
        'xtemplates' => '',
        'xitem_tpl' => '<a href="{url}">{title}</a>',
        'xitem_current_tpl' => '<span>{title}</span>',
        'date_format' => 'Y/m/d',
        'code_formatting' => false,
        'debug' => false
    );

     

  6. Hello all,

    I am trying to enable webp support for images, but i am having some problems with it.

    Somehow i have uploaded some images but i cannot delete them from field, when i try to delete it is log me out of processwire. See attached screenshots.

    P.s my server supports webp images.

    On my server logs i have only these errors:

    [Mon Jun 01 21:57:30.399211 2020] [fcgid:warn] [pid 26424] [client 162.158.88.107:22838] mod_fcgid: stderr: #4 /public_html/wire/core/ProcessController.php(337): ProcessWire\\Wire->__call('executeEdit', Array), referer: /setup/language-translator/edit/?language_id=1154&textdomain=wire--modules--languagesupport--languagesupport-module&filename=wire/modules/LanguageSupport/LanguageSupport.module
    [Mon Jun 01 21:57:30.399219 2020] [fcgid:warn] [pid 26424] [client 162.158.88.107:22838] mod_fcgid: stderr: #5 public_html/wire/core/Wire.php(380): ProcessWire\\ProcessController->___execute()   setup/language-translator/edit/?language_id=1154&textdomain=wire--modules--languagesupport--languagesupport-module&filename=wire/modules/LanguageSupport/LanguageSupport.module
    [Mon Jun 01 21:57:30.399226 2020] [fcgid:warn] [pid 26424] [client 162.158.88.107:22838] mod_fcgid: stderr: #6 /public_html/wire/core/WireHooks.php(823): ProcessWire\\Wire- in /public_html/wire/modules/LanguageSupport/ProcessLanguageTranslator.module on line 634, referer: /setup/language-translator/edit/?language_id=1154&textdomain=wire--modules--languagesupport--languagesupport-module&filename=wire/modules/LanguageSupport/LanguageSupport.module

     

    Can anyone point me to right direction?

    Thanks in advance

    error1.jpg

    error2.jpg

  7. 7 hours ago, fisnik said:

    Session

    [%%.sessions] Error: Table '%%.sessions' doesn't exist
    [%%.sessions] status: Operation failed

    I dont know why this happend but i also cannot create new tabel with name "sessions" on same database.

    Workaround:

    I did create new database, imported old one (sessions does not exist here)

    then i run:

    CREATE TABLE `sessions` (
      `data` mediumtext NOT NULL,
      `id` int(11) NOT NULL,
      `ip` varchar(256) NOT NULL,
      `pages_id` varchar(256) NOT NULL,
      `ts` varchar(256) NOT NULL,
      `ua` varchar(256) NOT NULL,
      `user_id` varchar(256) NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
     

  8. Does anyone know why i am getting this error on some site today, no changes were made?

     

     

    Error: Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table '%%.sessions' doesn't exist (in wire/core/WireDatabasePDO.php line 454)

    #0 wire/core/WireDatabasePDO.php(454): PDOStatement->execute()
    #1 wire/modules/Session/SessionHandlerDB/SessionHandlerDB.module(74): WireDatabasePDO->execute(Object(PDOStatement))
    #2 [internal function]: SessionHandlerDB->read('vvvciffpban8u80...')
    #3 wire/core/Session.php(267): session_start()
    #4 Wire.php(380): Session->___init()
    #5 wire/core/WireHooks.php(698): Wire->_callMethod('___init', Array)
    #6 wire/core/Wire.php(442): WireHooks->runHooks(Object(Session), 'init', Array)
    #7 wire/core/Session.php(166): Wire->__call('init', Array)
    #8 /wire/core/Session.php(166): Session->init()
    #9 public_html/w

     

  9. I am using processwire with multi language. I have set up multi language and it is working perfect. What i need is that when a user chooses a language when he visits  web for the first time to be remembered like a session or cookie next time when he visit that web. I have searched in forum but couldn't find anything. Ant help would be appreciated. Thank you

  10. This is working fine, only when i use language alternative fields it is not showing the other language file. i have created both fileds pdf and pdf_de.

    This is the code that i am currently using to call the files:

         <?php
        $features = $pages->get("1029")->children("limit=6, sort=sort");
        foreach($features as $feature) {
        echo "<li>" .
        "<a class='readmore4' href='{$feature->url}'><p class='texti4'>{$feature->title}</p></a>" .
        "</li>";
        }
        ?>

  11. Thanks for you reply Rayn, that line is not commented and it is still no overwirting windows default temp folder, i have managed somehow (i am not sure how, i told server admin to make some folders writable...) to upload pictures only on new posts and it is working fine.

    With old posts i have problem with uploadin pictures, i have an error destinationPath is now writable.

    But it is ok like this if new posts are working, if i found a solution for old posts i will let you now. 

  12. i have a problem uploading images/file at processwire installed on windows 2012 iis7.5 server
     
    when i try to upload it shows: Error writing to C:\Windows\TEMP. PLease define $config->uploadTmpDir and ensure it is writable.
     
    at config.php i have $config->uploadTmpDir = dirname(__FILE__) . '/assets/uploads/'; 
    this folder is created.
     
    Any idea how to fix this?

    php shows this info - Can i overwrite it from processwire?

    upload_tmp_dir C:\Windows\temp C:\Windows\temp
×
×
  • Create New...