Jump to content

Smirftsch

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by Smirftsch

  1. I usually tend to avoid js if possible, but the idea to use it here definitely makes sense. Not what I had in mind in the first place, but good approach, thanks 🙂

    Edit: However, this doesn't really help to place it freely with CKEditor somewhere into the page, which is something people often expect since this is more or less a basic functionality they know from systems like WP. I think I can create this myself though.

     

  2. for anyone digging such a thing, I mostly solved it now by using "renderNavTree($page.." instead of "renderNavTree($page->rootParent..." in basic-page and using parents() additionally:

     

    // cycle through all the items
    	foreach($items as $item) {
    	
    		if (renderParent && $item->id == wire('page')->id)
    		{		
    			$SkipLevel = 1; // Skip homepageroot 
    			foreach($item->parents() as $pitem) 
    			{					
    				if ($SkipLevel)
    				{
    					$SkipLevel--;
    					continue;	
    				}
    				$out .="<ul><li class='parentnav'><a href='$pitem->url'>$pitem->title</a></li>";
    			}
    			$out .="<ul>";
    		}
    ...

    only need to make it render 1st level of parentRoot yet 🙂

  3. Ok, I am absolutely sure I am missing something simple again, I also read a few more or less similar topics here, yet I couldn't find an answer.

    I am using pretty much the original function renderNavTree:

    function renderNavTree($items, $maxDepth = 0, $fieldNames = '', $class = 'nav') {
    
    	// if we were given a single Page rather than a group of them, we'll pretend they
    	// gave us a group of them (a group/array of 1)
    	if($items instanceof Page) $items = array($items);
    
    	// $out is where we store the markup we are creating in this function
    	$out = '';
    
    	// cycle through all the items
    	foreach($items as $item) {
    
    	    $pageid = wire('page')->id;
    		// markup for the list item...
    		// if current item is the same as the page being viewed, add a "current" class to it
    		$out .= $item->id == wire('page')->id ? "<li class='current'>" : "<li>";
    
    		// markup for the link
    		$out .= "<a href='$item->url'>$item->title.$item->id.$pageid</a> ";
    
    		// if there are extra field names specified, render markup for each one in a <div>
    		// having a class name the same as the field name
    		if($fieldNames) foreach(explode(' ', $fieldNames) as $fieldName) {
    			$value = $item->get($fieldName);
    			if($value) $out .= " <div class='$fieldName'>$value</div>";
    		}
    
    		// if the item has children and we're allowed to output tree navigation (maxDepth)
    		// then call this same function again for the item's children 
            if($item->hasChildren() && $maxDepth ) {
    			if($class == 'nav') 
                    $class = 'nav nav-tree';
                if ($maxDepth > 1 || $item->id == wire('page')->id)
        				$out .= renderNavTree($item->children, $maxDepth-1, $fieldNames, $class);
        			else {
        				foreach($item->children as $childitem) {
        				if ($childitem->id == wire('page')->id)
        					$out .= renderNavTree($item->children, $maxDepth-1, $fieldNames, $class);
        				}
        			}
    		}
    
    		// close the list item
    		$out .= "</li>";
    	}
    
    	// if output was generated above, wrap it in a <ul>
    	if($out) $out = "<ul class='$class'>$out</ul>\n";
    
    	// return the markup we generated above
    	return $out;
    }

     

    but I want it only to render the children of the selected page.

    Right now the output is like that (having lets say "child2 of child1 selected):

    Parent Page

    • Parent
      • child 1
        • child of child 1
        • child2 of child 1
          • child of child2

    Fine so far and looks as wanted- BUT - problem appears if having more than one child of parent- it looks like this:

    • Parent
      • child 1
        • child of child 1
        • child2 of child 1
          • child of child2 of child 1
      • child 2
        • child of child2
        • child2 of child2

    while I only would want it to render the tree of child 1, not of child2.

    Since all are children of Parent (hence same wire('page')->id), I can't distinguish it with id, but what else can I do here?

    Ok, I realized that this question is maybe confusing, what I wanted to archive is that only the navtree of the selected page is being rendered, nothing else (well if being absolutely perfect maybe 1 level of rootParent also).

  4. I want to use the WireFileTools $files->find function, but no matter what I try I only get a server error (either error 500 or "Call to a member function find() on null").

    If my understanding of the docs is right, I only need to call it with $files->find($somepath); - but is there some include, some init or something else needed?

    Obviously I am missing something, maybe someone can enlighten me.

     

  5. Thanks, but its not images for the most part, it's mostly .zip and .7z files- other than that this method would be really nice 🙂

    After some more reading WireFileTools seem to be able to do what I need, but I am unsure yet how to use it. I'll ask in another post about it.

  6. I have a page I want to migrate to PW and it contains big download sections with hundreds of files. The files are in directories on the server already, what is the best approach to get them in a page?

    Is there some method I missed? Are there any plugins? Or would it be best to do with a filemanager for ckeditor?

    Any advice is very welcome.

     

  7. Thanks!

    I came across this page already and none of the mentioned things have been working.

    That's why I was asking here, I assumed there could be some kind of setting in PW I missed maybe. Of course it is possible that such changes are not supported by the server, but then I am wondering how other tools like Wordpress are bypassing such limits.

    Either way, if this is really just being limited by PHP settings I still can contact my server host.

    Any more information is very welcome 🙂

     

  8. Got this the morning:

    Quote

    We have hacked your website and extracted your databases.

    How did this happen?
    Our team has found a vulnerability within your site that we were able to exploit. After finding the vulnerability we were able to get your database credentials and extract your entire database and move the information to an offshore server.

    What does this mean?

    We will systematically go through a series of steps of totally damaging your reputation. First your database will be leaked or sold to the highest bidder which they will use with whatever their intentions are. Next if there are e-mails found they will be e-mailed that their information has been sold or leaked and your site was at fault thusly damaging your reputation and having angry customers/associates with whatever angry customers/associates do. Lastly any links that you have indexed in the search engines will be de-indexed based off of blackhat techniques that we used in the past to de-index our targets.

    How do I stop this?

    We are willing to refrain from destroying your site's reputation for a small fee. The current fee is .33 BTC in bitcoins ($3000 USD).

    Send the bitcoin to the following Bitcoin address (Copy and paste as it is case sensitive):

    ---

    Once you have paid we will automatically get informed that it was your payment. Please note that you have to make payment within 5 days after receiving this notice or the database leak, e-mails dispatched, and de-index of your site WILL start!

    How do I get Bitcoins?

    You can easily buy bitcoins via several websites or even offline from a Bitcoin-ATM. We suggest you https://cex.io/ for buying bitcoins.

    What if I don’t pay?

    If you decide not to pay, we will start the attack at the indicated date and uphold it until you do, there’s no counter measure to this, you will only end up wasting more money trying to find a solution. We will completely destroy your reputation amongst google and your customers.

    This is not a hoax, do not reply to this email, don’t try to reason or negotiate, we will not read any replies. Once you have paid we will stop what we were doing and you will never hear from us again!

    Please note that Bitcoin is anonymous and no one will find out that you have complied.

    Question is, are such attacks known and how likely are they? I highly doubt it, since there is nothing of use in this database anyway and it very much seems it was just sent using the contact form.

     

    Related to that- it might be best nevertheless to change database password, is there some documentation on how to do that properly?

     

  9. Hello all!

    I am building a page for one of my clients and he wants to restrict content for a specific domain name. The .com has to show all pages and children, but the .de domain is supposed to show only a few pages/children of the .com domain.  It is a multi language page and the ability to switch languages should be kept as well.

    Are there any recommendations or even modules how to do such a thing?

    I was digging the forums but haven't found anything so far. Perhaps I am just missing the right keywords only 🙂

  10. I've got some odd problem adding additional styles to mystyles.js. After reading some and following the article here: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/modules/Inputfield/InputfieldCKEditor/README.md#custom-editor-js-styles-set

    I was able to add a custom style. So far so good 😉

    It is displayed in the Styles menu and can be selected there. Now the odd thing starts, if I add a custom style like this:
     

    ...
    
     { name: 'Box Top', element: 'span',attributes: { 'class': 'box_top' } },
     { name: 'Box Bottom', element: 'span', attributes: { 'class': 'box_bottom' } }

     

    it works and can be selected just fine.

    However, if I add this:

     { name: 'Box Top', element: 'div',attributes: { 'class': 'box_top' } },
     { name: 'Box Bottom', element: 'div', attributes: { 'class': 'box_bottom' } }

    It is also displayed, can be selected - BUT - once the edit is saved, it is gone, won't be displayed in the page and won't be shown anymore in the editor as selected style, it goes back to "normal".

     

    Can anyone give me a hint what I missed?

×
×
  • Create New...