-
Posts
85 -
Joined
-
Last visited
Everything posted by ankh2054
-
thanks for your help Raymond, sounds like a good plan
-
thanks Raymond and sorry for being so needy, I'm such a newbie. The code you provided gives me the following error. Parse Error: syntax error, unexpected T_PUBLIC (line 6 of /var/www/www.bommachine.co.uk/site/templates/hybrid.php) Line 6 public function ___actionHybridAuth() {
-
thanks Raymond, do I actually need the hybridauth module for the above? As I have now decide not to use it and implement manually.
-
from what I can see the .htaccess blocks access to the site/modules/ directory. Error I get: You don't have permission to access /site/modules/ProcessHybridAuth/hybridauth/
-
thanks Raymond, getting there now... Getting stuck with BASE_URL now. What do you add as your "base_url" => "http://site_namesite/modules/ProcessHybridAuth/hybridauth/",
-
Hi All, Wondered if anyone could provide me with some assistance with Hybridauth. I've installed the module, and just testing it with the following code. $hybridauth = new Hybrid_Auth( $ha_config ); $adapter = $hybridauth->authenticate( $provider_name ); I get the following error. I have checked the pat and it does exist. Error: Exception: Hybriauth config does not exist on the given path. (in /var/www/web_new/site/modules/ProcessHybridAuth/hybridauth/Hybrid/Auth.php thanks for any help
-
thanks all for your help, the below worked as per instructions. foreach($matches as $m) { $out .= " <div class='media col-md-3'> <a href='{$m->url}' class='list-group-item'> <h5 class='list-group-item-heading'>{$m->title}</h4>"; foreach($m->food_types as $ft){ // Iterate through the pages here $out .= "<h5 class='list-group-item'>Type:{$ft->title} </h5>"; // Output the title here } $out .= " <p class='list-group-item-text'>{$m->body}</p> </a> </div>"; }
-
thanks very much, the first() method works successfully. This is more of a PHP question than processwire, so accept my newbiness. I am using search.php to show a list of ingredients and their associated food_types. <h5 class='list-group-item'>Type:{$m->food_types->first()->title}</h5> Need to somehow add your foreach loop into an existing for each loop to ensure it shows all the selected pages and not only the first one. Any ideas? foreach($matches as $m) { //Theme each search result $out .= "<div class='media col-md-3'> <a href='{$m->url}' class='list-group-item'> <h5 class='list-group-item-heading'>{$m->title}</h4> <h5 class='list-group-item'>Type:{$m->food_types->first()->title}</h5> <p class='list-group-item-text'>{$m->body}</p> </a> </div>"; } $out .= "</div>"; thanks for your help
-
Hi all, Struggling to get the title of a page field type. Have created a page called Almonds. The almonds page has a page field type called food_types, where one page is selected. If I load the page almonds using the below code I get the ID associated with that page field type, but I'm unsure of how to get the title. I have tried the below and get nothing, guessing I'm not doing it right. Could someone advise. thanks so much Charles
-
thanks Would you have an idea of how to load the built in tinymce?
-
Hi All, I have created a body field and set the input type as Tinymce, but it does not load when I try to create a new page and populate the body field. The module is installed and enabled. Should I be doing anything else? My code: // Process new topic creation if($input->post->create_comment) { //Sanatize variables taking in the form data $title = $sanitizer->text($input->post->title); $body = $sanitizer->textarea($input->post->body); $newPost = new Page(); // create new page object $newPost->template = wire('templates')->get('discussions-topic'); // set template $newPost->parent = $page; //Set the parent to the current page $newPost->title = $title; // set page title (not neccessary but recommended) $newPost->body = $body; //Set the body //$newPost->discussions_author = $user; //Might be able to remove this !!!!! check as I think processwire automatically remembers the username $newPost->save(); } <form class="form-horizontal" action="./" accept-charset="UTF-8" enctype="multipart/form-data" autocomplete="off" method="post"> <div class="form-group"> <label for="inputFullname3" class="col-sm-2 col-md-3 control-label">Title</label> <div class="col-md-9"> <input type="text" class="form-control" name="title" placeholder="Enter the Title" > </div> </div> <div class="form-group"> <label for="inputFullname3" class="col-sm-2 col-md-3 control-label">Body</label> <div class="col-md-9"> <textarea name='body' rows='12' cols='80' id='body' placeholder="Your message"></textarea> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button class="btn btn-primary" type="submit" name="create_comment" value="create_comment">Create Comment</button> </div> </form> thanks for any help
-
I added this to the above and it worked. $bottom_options_reply = ''; //Footer button display options - Reply $bottom_options_reply = ''; if ($reply->createdUser->name == $user->name){ $bottom_options_reply .= "<p> This is the current owner</p>"; }
-
Hi All, Wonder if someone could assist me with the below. I have created a foreach loop to show all the children pages of current page. This works. I am then trying to show different text for each child based on whether the current logged in user is the owner or not. This works, apart from at each loop iteration the previous results are added prior to the current. <?php $results = $page->children; foreach($results as $reply) { //Bottom post buttin display options - Reply if ($reply->createdUser->name == $user->name){ $bottom_options_reply .= "<p> This is the current owner</p>"; } else { $bottom_options_reply .= "<p> This is not the owner </p>"; } //Theme each topic echo " <div class='panel panel-default'> <div class='panel-body'> <div class='col-md-3'> {$avatar_profile_logo} {$reply->createdUser->name} </div> <div class='col-md-6'> {$reply->body} </div> </div> <div class='panel-footer'> {$bottom_options_reply} </div> </div> "; Below is the screenshot of the results, showing the $bottom_options_reply being added multiple times.
-
thanks teppo
-
What I ended up doing is creating pages, and within those pages creating children as topics, replies to those topics then become children of the respective topic. thanks Apeisa for your useful code, which helped me steer my own code in the right direction.
- 1 reply
-
- 1
-
Found another way, but would be interested to know how it would work the other way. <? echo count($page->children) ?>
-
Hi all, I am trying to count the child pages of the current page, but Im doing something wrong and I don't quite understand what that is. $total = $pages->count("$page->children"); I have also tried the following $total = $pages->count($page->children); could someone help please
-
Hi All, I would like to implement the following to my site and was wondering whether it would be possible. Modules I have been looking at. Core - Comments Apeisa - http://modules.processwire.com/modules/discussions/ Users will be allowed to create pages, those pages will be assigned a template automatically and have 3 fields. Image, Title and body. When you view that page, I would like to have the ability to have each page act as it's own forum where users can create topics and post replies to that topics. Using Apeisa's module I think this should be possible. So what I am thinking is of adding a form on the page whig allows suers to create topics. Each topic created is then attached to that page as a child, each reply is then attach to those topics as a children. Am I on the right track?
-
Loading pages and showing image field of each
ankh2054 replied to ankh2054's topic in API & Templates
thanks Adrian, I ended up using a if else clause, to show a default image if no image available. -
I see thanks for the info that make sense. Updated the code as following: / Pull all discussion pages if ($item->discuss_image->url){ $discuss_image = $item->get("discuss_image"); $discuss_logo = $discuss_image->size(200,200, $image_options); $discuss_image_logo = "<img class='img-rounded img-responsive' src='{$discuss_logo->url}'' alt='{$discuss_image->description}'' />";
-
Hi, I am using the following code to display multiple pages and adding the pages respective image OR default image if no image is available. But what seems to happen is that for each loop an additional image is added. Hope that make sense, I've added a screenshot for clarity. // Pull all discussion pages $discussions = $pages->find("template=discussions"); foreach($discussions as $item) { //Load and assign Image if ($item->discuss_image->url){ $discuss_image = $item->get("discuss_image"); $discuss_logo = $discuss_image->size(200,200, $image_options); $discuss_image_logo .= "<img class='img-rounded img-responsive' src='{$discuss_logo->url}'' alt='{$discuss_image->description}'' />"; } else { $discuss_image_logo .= "<img class='img-rounded img-responsive' src='{$config->urls->templates}/styles/images/bom-mashien_logo.png' alt='BOMmachine' />"; } //Theme each page echo " <a href='{$item->url}' class='list-group-item'> <div class='media col-md-3'> <figure class='pull-left'> {$discuss_image_logo} </figure> </div> <div class='col-md-6'> <h4 class='list-group-item-heading'>{$item->title}</h4> <p class='list-group-item-text'>{$item->body}</p> </div> <div class='col-md-3 text-center'> <h2> 14240 <small> votes </small></h2> <button type='button' class='btn btn-default btn-lg btn-block'> Vote Now! </button> <div class='stars'> <span class='glyphicon glyphicon-star'></span> <span class='glyphicon glyphicon-star'></span> <span class='glyphicon glyphicon-star'></span> <span class='glyphicon glyphicon-star'></span> <span class='glyphicon glyphicon-star-empty'></span> </div> <p> Average 4.5 <small> / </small> 5 </p> </div> </a> "; } thanks in advance for any help.
-
Loading pages and showing image field of each
ankh2054 replied to ankh2054's topic in API & Templates
Wondered if it was due to not all discuss pages had images, so I did the below and it worked. / Pull all discussion pages $discussions = $pages->find("template=discussions"); foreach($discussions as $item) { //Load and assign Image if ($item->discuss_image->url){ $discuss_image = $item->get("discuss_image"); $discuss_logo = $discuss_image->size(200,200, $image_options); $discuss_image_logo .= "<img class='img-rounded img-responsive' src='{$discuss_logo->url}'' alt='{$discuss_image->description}'' />"; } else { $discuss_image_logo .= "<img class='img-rounded img-responsive' src='{$config->urls->templates}/styles/images/bom-mashien_logo.png' alt='BOMmachine' />"; } //Theme each page -
Loading pages and showing image field of each
ankh2054 replied to ankh2054's topic in API & Templates
yes indeed. -
Loading pages and showing image field of each
ankh2054 replied to ankh2054's topic in API & Templates
thanks Horst. Sorry for more questions, but now I get the following error. Error: Call to a member function size() on a non-object $discuss_logo = $discuss_image->size(200,200, $image_options);