Jump to content

rareyush

Members
  • Posts

    73
  • Joined

  • Last visited

Posts posted by rareyush

  1. 1 hour ago, Gary Austin said:

    Assuming $rate is the final string you will output later, you need to set $rate="" before loop and use $rate .= "<sp...." in the loops.  the '.=' is the key.

    thanks it worked. 

  2. $rating = $item->rating;
    
    	for ($i = 1; $i <= $rating; $i++) {
    
          if ($i <= $page->rating) {
            $rate = "<span class='fa fa-star star selected '> </span>";
          }
          else {
            $rate = "<span class='fa fa-star'> </span>";
          }
      }

     

    I am using this and and I can see only 1 star everywhere, where i am wrong???

  3. I am using new processwire and I am receiving this error in my _func.php

     

    Parse Error: syntax error, unexpected 'return' (T_RETURN) 
    
    Parse Error: syntax error, unexpected '$out' processwire

    anyone knows anything ??

  4. I moved my site to Google cloud platform and i am stuck some where.

    my homepage is working fine but when it comes to other pages it says 404 not found

    and when i add this on virtual host 

     

      <Directory "/var/www">
             Options Indexes FollowSymLinks
             AllowOverride All
             Require all granted
            </Directory>
    
    or
      <Directory "/var/www">
              AllowOverride All
             </Directory>

     

     
     

    I receive internal server error 

     

     

     

    I tried comment out this line to but still same thing 

    # RewriteBase /
    and

      # RewriteRule ^(.*)$ /index.php?it=$1 [L,QSA]

  5. I am using this function to get blogpost but I don't see what's wrong in it and why it is now showing anything in frontend.

     

    function ukBlogPost(Page $page, $options = array()) {
    	
    	$defaults = array(
    		'summarize' => null, // Display blog post summary rather than full post? (null=auto-detect)
    		'metaIcon' => 'info',
    		'moreIcon' => 'arrow-right',
    		'moreText' => __('Read more'), 
    		'categoryIcon' => 'hashtag',
    		'bylineText' => __('Posted by %1$s on %2$s'), 
    	);
    
    	$options = _ukMergeOptions($defaults, $options);
    	$title = $page->title;
    	$img = $page->images->first();
    	$date = $page->date ? $page->date : $page->createdStr;
    	$name = $page->createdUser->name; 
    	$body = summarizeText($page->get('body'), 100);
    	$metaIcon = ukIcon($options['metaIcon']);
    	$moreIcon = ukIcon($options['moreIcon']);
    	$categoryIcon = ukIcon($options['categoryIcon']);
    	$n = $page->comments->count();
    	$numComments = $n ? "<a href='$page->url#comments'>" . ukIcon('comments') . " $n</a>" : "";
    	$itn = $page->get('itineraries');
    	
    	$ito = $itn->each( "<h4> {itineraries_title}</h4> <p>{itineraries_details} </p> ");
    
    	if($options['summarize'] === null) {
    		// auto-detect: summarize if current page is not the same as the blog post
    		$options['summarize'] = page()->id != $page->id;
    	}
    	
    /*	$categories = $page->categories->each($categoryIcon . 
    		"<a class='uk-button uk-button-text' href='{url}'>{title}</a> "
    	);*/
    
    	if($options['summarize']) {
    		// link to post in title, and use just the first paragraph in teaser mode
    		$title = "<a href='$page->url'>$title</a>";
    		$body = explode('</p>', $body); 
    		$body = reset($body) . ' ';
    		$body .= "<a href='$page->url'>$options[moreText] $moreIcon</a></p>";
    		$class = 'blog-post-summary';
    	} else {
    		$class = 'blog-post-full';
    	}
    
    	if($options['summarize']) {
    		$heading = "<h4 class='uk-margin-remove tour-heading'>$title</h4>";
    	} else {
    		$heading = "<h3 class='uk-article-title uk-margin-remove tour-heading'>$title</h3>";
    	}
    	
    	$byline = sprintf($options['bylineText'], $name, $date); 
    	
    	if($img) {
    		$img = $img->size(375,380);		
    	}
    	
    	// return the blog post article markup
    	return "
    
    	<div>	
    	<div class='uk-card'>
        	<div class='uk-inline-clip uk-transition-toggle'>
           	<img src='$img->url' alt='$img->description' class='uk-border-rounded uk-transition-scale-up uk-transition-opaque' > 
           	 <div class='uk-overlay uk-light uk-position-bottom'>
            			<p class='uk-text-light'>$heading</p>
       		 </div>     
        	</div>
       
          $ito
    	</div>
    	</div>
    	
    	";	
    }

     

     

    I tried running $title, $img etc. - or are they all blank? simultaneously but nothing returns anything.

     

    I do not know why it is not working 

  6. On 3/17/2018 at 10:50 PM, elabx said:

    Why don't you have a text field in the category page you just created? After created, you can click the title (if using ASM Select for example) to open the page and add more content.

    text field won't work here because when user select create new I want to show 2 text fields there.

  7. 6 hours ago, elabx said:

     

    Maybe that page also has a contact-form template assigned? If you do a $pages->get() it will only return the first page matching your selector , so if you have multiple pages with template "contact-form", it might not return the one you think of, but the first one PW encounters.

    I have only one page using " contact -form " template & I want all information there only from both contact forms.

  8. I am trying too create a custom field where when user select to create a category 2 text area shows where one title of the category goes & another for some content.

    Like in a picture I want 2 text areas when I click on create new

    oi.PNG

  9. 18 hours ago, flydev said:

    Please post the relevant errors here.

    There is not error, as I mentioned I created contact form template where I save contact info like this in a page but when I created another contact page template I was getting error thanks to you error is gone but I am getting contact information saved in this page "contact".

    contact image.PNG

  10. 4 hours ago, flydev said:

    Your parent page is not assigned in a correct way.

    
    $form->parent = $page('template=contact-form'); // optional, saves form as page

    should be

    
    $form->parent = $pages->get('template=contact-form')->id; // optional, saves form as page

     

    $form->parent = $page->get('template=contact-form')->id; // optional, saves form as page 

    it does only one thing, it stops showing error but I am getting error in admin panel where I used this template "contact-form".

  11. I created a template where I am rendering this php file where I am saving contact quires in a template and it is working fine in homepage.

    I used my same code in another page on a same project by creating another template and rendering another file but I am receiving this error again and again, I tried to figure out but it not working.

     

    <?php namespace ProcessWire; 
    
    	
    
    $form = $modules->get('FormTemplateProcessor');$form->template = $templates->get('contact'); // required
    $form->requiredFields = array('title', 'fullname','email_form', 'mobile', 'message');
    //$form->email = 'your@email.com'; // optional, sends form as email
    $form->parent = $page('template=contact-form'); // optional, saves form as page
    $form->render();  // draw form or process submitted form
    
    
    
    
    ?>
    		<?php echo $form->render(); ?>

     

    error I am receiving 

    Quote

    Error: Exception: Can't save page 0: /18-03-16-14-04-26-000000/: It has no parent assigned (in path\wire\core\PagesEditor.php line 469)

    #0 path\wire\core\Pages.php(410): ProcessWire\PagesEditor->save(Object(ProcessWire\Page), Array)
    #1 path\wire\core\Wire.php(386): ProcessWire\Pages->___save(Object(ProcessWire\Page), Array)
    #2 path\wire\core\WireHooks.php(698): ProcessWire\Wire->_callMethod('___save', Array)
    #3 path\wire\core\Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), 'save', Array)
    #4 path\wire\core\Page.php(2376): ProcessWire\Wire->__call('save', Array)
    #5 path\site\assets\cache\FileCompiler\site\modules\FormTemplateProcessor\FormTemplateProcessor.module(205): ProcessWire\Page->save()
    #6 path\wire\core\Wire.php(383): FormTemplatePr

    This error message was shown because: you are logged in as a Superuser. Error has been logged.

     anyone can any solutions for it ?

  12. 12 hours ago, kixe said:

    Put the code I have posted in your ready.php and replace $this with $wire.

    
    $wire->addHookBefore('PagefilesManager::path', function ($e) {
       $e->replace = true;
       $e->return = null;
    });

    Thanks kixe

    Love you a lot, you solved my big problem, I was trying to add that code in my main file & in init file.

     

    Thanks a lot

  13. 12 hours ago, kixe said:

    Please post your code or explain exactly what you are doing.

    from admin panel I created new field whose type I choose 'file'.

    i have a template for contact form where i want to put this field and give access to upload files options to users

    but when i add this new field in that template my site stops working, i saw that error which i posted above everywhere.

  14. On 1/13/2018 at 11:30 AM, kixe said:

    This is an old issue. I use the following workaround. In case of an unsaved page instance (id = 0) a hook is called from the render() method of my custom module, which provides a form (withfile field) based on a PW template in the frontend:

    
    $this->addHookBefore('PagefilesManager::path', function ($e) {
       $e->replace = true;
       $e->return = null;
    });

    https://github.com/ryancramerdesign/ProcessWire/issues/1259

    this one doesn't work :(

  15. I am trying to add a file type field in a template but when I give access to the template I receive this error

    Error: Exception: New page '//' must be saved before files can be accessed from it (in /mysite/wire/core/PagefilesManager.php line 342)
    
    #0 /mysite/wire/core/PagefilesManager.php(328): ProcessWire\PagefilesManager->___path()
    #1 /mysite/wire/core/PagefilesManager.php(268): ProcessWire\PagefilesManager->path()
    #2 /mysite/wire/core/PagefilesManager.php(106): ProcessWire\PagefilesManager->createPath()
    #3 /mysite/wire/core/PagefilesManager.php(90): ProcessWire\PagefilesManager->init(Object(ProcessWire\Page))
    #4 /mysite/wire/core/Page.php(3498): ProcessWire\PagefilesManager->__construct(Object(ProcessWire\Page))
    #5 /mysite/wire/core/Pagefiles.php(132): ProcessWire\Page->filesManager()
    #6 /hom
    
    This error message was shown because: you are logged in as a Superuser. Error has been logged.

     

  16. 22 hours ago, lokomotivan said:

    How's jquery blocked in some browsers by default?

    Anyways, you can achieve this with just css, something like this (well this is way over simplified):

    
    <ul class="my-menu">
      <li><a>item 1</a></li>
      <li><a>item 2</a></li>
      <li>
        <a>item 3</a>
        <ul class="submenu">
            <li>submenu item</li>
            <li>submenu item</li>
        </ul>
      </li>
      <li><a>item 4</a></li>
    </ul>
    
    <style>
      .my-menu > li:nth-child(3) > .submenu {
      	width:100%;
      }
    </style>

     

    my seniors told me that jquery is blocked in some browsers that's why try not use too much of jqueries

    but I am using loop and all the childrens are coming from a loop

    and i want full width menu on 3rd menu only not others, because 3rd menu is the only menu who has many submenus

     

    22 hours ago, Ivan Gretsky said:

    Happy new year, @rareyush! And yes, we are still celebrating here in Russia)

    As I got it, you want a menu kind of like on this site (you can look at some css to get inspiration, but js is also involved there).

    I think, you can achieve it with css-only. But I would not bother too much for full capability for no-js users these days. Provide some (possibly ugly) fallback to keep the site usable.

    Here is a nice link to start with css-only menus as a bonus)

    Thank you I'm reading 

     

     

  17. hi everyone

     

    I am trying get a full width sub-menu on 3rd item in menu or navbar which is coming from a loop.

    i was hoping this can be done by using jquery by targeting 3rd element in navbar but jquery is blocked in some browser by default so is there any other method I can do this ???

  18. 16 hours ago, rafaoski said:

    Welcome to the forum @rareyush ... Sanitizer can help in this case which cleans up the text.
    https://processwire.com/api/variables/sanitizer/
    https://processwire.com/api/ref/sanitizer/
    https://processwire.com/api/ref/sanitizer/text/
    Try the following:

    
    $p_body = $sanitizer->text($key->body,['maxLength' => 250]);
    echo "<p>{$p_body}</p>";

     

     

    This worked for me, Thank you

    I really appreciate and this is why I love processwire more now xD 

    • Like 1
  19. I'm trying to display body part but as a summary which doesn't include any image.

     

    I was able to get limit the words by using this function

     

    <?PHP
      function truncateWords($input, $numwords, $padding="")
      {
        $output = strtok($input, " \n");
        while(--$numwords > 0) $output .= " " . strtok(" \n");
        if($output != $input) $output .= $padding;
        return $output;
      }
    ?>

    but if there is an image it show that image as well.

     

    any api or anything which I can use to use show just limited text ?????

×
×
  • Create New...