Laravel Elixir watch not working properly - php

So when I create a new Laravel project, gulp watch worked very perfectly. Now I'm working on PyroCMS project which is also used Laravel and the gulp watch kinda fails. I don't know why.
It seems to have a problem with watching multiple sass files at the same time. It does not watch at all. However, with one sass file, it works perfectly.
Here is my code:
var sassPath = './addons/dscms/anomaly/generali-theme/resources/sass/',
cssPath = './addons/dscms/anomaly/generali-theme/resources/css/',
jsPath = './addons/dscms/anomaly/generali-theme/resources/js/',
jsCopyPath = './addons/dscms/anomaly/generali-theme/resources/js/my-js/';
elixir(mix => {
mix
.sass([
''+sassPath+'main-style.sass',
''+sassPath+'section1.sass',
''+sassPath+'section2.sass'
], ''+cssPath+'main.css')
.scripts([
''+jsPath+'main.js',
''+jsPath+'main-2.js',
''+jsPath+'main-3.js'
],''+jsCopyPath+'main.js');
});
It also work with multiple js files but not sass files. Please help me with this one. Thank you very much!

I'm sorry for that. That was completely my fault :) The syntax was a little bit wrong there. The correct code is like this
mix
.sass(''+sassPath+'*.*', ''+cssPath+'main.css')
and I tested it. It watched multiple files and concatenated into one file. Worked perfectly!

Related

The variable seems to be independent, but the program works fine. why?

I'm using the following library to give a update feature to my WordPress and this works fine with the code of documentation.
https://github.com/YahnisElsts/plugin-update-checker/blob/master/README.md
require 'plugin-update-checker/plugin-update-checker.php';
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://github.com/user-name/repo-name/',
__FILE__,
'unique-plugin-or-theme-slug'
);
But I'm really wondering where this '$myUpdateChecker' variable came from and how this is working, because I can't find any part of the library's files using this variable.
It seems to be totally independent for me.
Thank you in advance.
You're creating the variable right there. You can even name it something else if you want (eg. $update_checker), that shouldn't cause any issues in this particular case as the variable isn't being used anywhere else (according to your own words.)
For more details: PHP variables.

Codeigniter: highlighting strings text in codeigniter

I tried to implement this(http://web.archive.org/web/20080506155528/http://software.zuavra.net/inline-diff/) with my codeigntier framework but i could not able to implement it.
Anyone if you have implemented this with codeigniter framework then please help me.
Why i could not able to implement:
I run those files seperately(Not with framework) & it worked for me. but while keeping the same files( i.e inline_example.php content) in my COdeigniter controllers then it showed me too many errors like(shown in image) . Then i though this is out of my capacity to implement with codeignter. so i thought to ask here help
i have implemented this library in codeigniter.
To resolve that error you have to replace &new variable to new in all library files of inline diff.
for example :
inline_function.php
$diff = &new Text_Diff($hlines1, $hlines2);
$diff = new Text_Diff($hlines1, $hlines2);
and also change path in unified.php and diff.php
require_once(APPPATH.'libraries/Text/Diff/Renderer.php');

Tumblr API in PHP File structure

I'm trying to use the Tumblr API (PHP) and I cant seem to get all the required files to load correctly.
The Tumblr API can be found here: https://github.com/tumblr/tumblr.php
First thing I found out is that it doesnt include OAuth, so after some searching I found the files on github and uploaded them to my server.
Now it's saying it needs Guzzle. OK, got that uploaded now, but I cant seem to get all the Guzzle files to load up... Example error message:
Interface 'Guzzle\Common\HasDispatcherInterface' not found in /TumblrTest/Guzzle/Common/AbstractHasDispatcher.php
There's a HasDispatcherInterface.php file in that path...
Do the files need to be in a special order? I tried putting all .php files into a folder, and then using require_once I searched for all *.php files in that folder, but that didnt work...
Sorry for a super noob question, any help would be greatly appriciated! Let me know if there's any other info i need to give to help answer this question!
-D
UPDATE: I still have no idea how the above works, but I found a way around it... I actually think it might be easier then figuring the above out!! The following PHP code does what i need it to do, which is grab the posts of the provided user:
$apikey = **[insert api key here]**;
$limit = $_POST['limit'];
$user = $_POST['user'];
$tumblr=$user . ".tumblr.com";
$apidata = json_decode(file_get_contents("http://api.tumblr.com/v2/blog/$tumblr/posts/photo?api_key=$apikey&limit=$limit"));
$mypostsdata = $apidata->response->posts;
$myposts = array();
$j = 0;
foreach($mypostsdata as $postdata) {
$post["photo_url"] = $postdata->photos[0]->original_size->url;
$post["width"] = $postdata->photos[0]->original_size->width;
$post["height"] = $postdata->photos[0]->original_size->height;
$myposts[$j] = $post;
$j++;
}
echo json_encode($myposts);
For some reason I cant get it to pull a list of people i'm following and then get their posts, but oh well...
The tumblr.php Readme might be a bit confusing.
The package depends on other packages. All can be installed via composer.
Go to the http://getcomposer.org and read this carfully, if you are used to the concept, you will start rewriting all you classes to fit the composer dependency manager ;-)
to make it short:
install composer globally and
go into a blank directory and
type in your terminal
composer require tumblr/tumblr
you should get all the classes and the other projects in a dir called vendor.
before you do anything you need to require the autoload.php file.
And check out the concept of namespaces in php.

Codeigniter add_column not working as expected

I'm trying to add some extra columns to an existing table with the codeigniter dbforge way.
I'm doing everything like this here. dbforge,add_column.
It wasn't working with the migrations, but after i tried to put the exact same code into some of my controllers with profiler turned on.
After this, i saw this info on the queries part. (Attaching an image)
I saw something like that in the buglist, but there it is fixed. So after this i tried to download a git version from codeigniter, but there is the exact same problem.
The code i'm trying to run is this:
$fields = array(
'preferences' => array('type' => 'TEXT')
);
$this->dbforge->add_column('users', $fields);
I'm sure that is something with the file at system/database/DB_forge.php file, but i wasn't able to resolve it.
Could someone point me in the good direction? Is something i'm doing wrong? Is something missing?
Thanks in advance for your kind help of all.

Scala Lift - Run PHP file from within scala runtime

I'm not entirely sure the wording for the title is correct, but what I'm attempting to do is run and execute PHP files from within the Lift framework.
I'm not after any url queries to a PHP file residing on a server, more interested in somehow getting the PHP runtime working through my Scala/Lift app.
Use case: I have my app packaged into a .war file, I host this via a cloud provider. I upload code snippets to said app which then runs the php file and does whatever necessary.
I've seen various posts regarding Bianca but am hoping to keep this setup light and require only the PHP binary itself and a little code to get it flying.
Thanks in advance, please let me know if you need me to elaborate :)
“Never say never, because limits, like fears, are often just an
illusion.”
― Michael Jordan
What you really need is an open source (GPL), embeddable, full PHP 5 implementation, written entirely in Java!
Caucho's Quercus PHP Java runtime is just that, and it will let you run PHP within a Java app without external libraries or native code.
Below is a Quercus-PHP-in-Java code sample I found in this answer
import javax.script.ScriptEngine;
import com.caucho.quercus.script.QuercusScriptEngineFactory;
QuercusScriptEngineFactory factory = new QuercusScriptEngineFactory();
ScriptEngine engine = factory.getScriptEngine();
String phpCode = "<?php $foo = strlen('abc'); print $foo; return 'yikes'; ?>"; //PHP Code as String
Object o = engine.eval(phpCode);
System.out.println(o);
It should be little effort to convert this code to idiomatic Scala. Obviously, the 'phpCode' variable could be constructed from external PHP file contents etc.
Let us know how you get on ;-)
That's a bit of an odd requirement, but if it's what you need to do, you can use a ProcessBuilder to execute and interact with your PHP script from the command line.

Categories