# |
Oct 9th 2016, 15:47 |
ndm |
no problem |
# |
Oct 9th 2016, 15:43 |
waspinator |
thanks for taking the time to troubleshoot my issue @ndm |
# |
Oct 9th 2016, 15:43 |
waspinator |
ah, it seems to be working after adding `Configure::write('App.base', '/');` it now outputs links to `http://localhost/` without adding the file path. I didn't have to use the `fullBaseUrl`. modifying it didn't seem to change anything. |
# |
Oct 9th 2016, 15:34 |
ndm |
@waspinator And `App.fullBaseUrl` |
# |
Oct 9th 2016, 15:24 |
ndm |
Try setting `App.base` manually |
# |
Oct 9th 2016, 15:24 |
ndm |
@waspinator On the shell, the "wrong" base is being generated, "wrong" as in incompatible for your needs... I'm not sure whether it is actually expected that CakePHP generates an actually web-ish webroot on the shell. |
# |
Oct 9th 2016, 15:21 |
waspinator |
oh and now with the `h()` in the pdf output, it actually shows the generated links instead of just empty strings. the issue is that the links use a URL, then proceed to use a regular file path, and then they don't even point to the right place. `bin/css`? I guess it's because I'm running a shell from `/bin/'? |
# |
Oct 9th 2016, 15:09 |
waspinator |
it should either output `/home/path/to/my/app/webroot/css/poop/poop.css` or `http://localhost/css/poop/poop.css` depending on how the PDF render likes its paths I guess. |
# |
Oct 9th 2016, 15:06 |
waspinator |
the path doesn't make sense though. I wouldn't be able to access the file using that URL |
# |
Oct 9th 2016, 15:06 |
waspinator |
okay, with `h()` I get `'link rel=andquot;stylesheetandquot; href=andquot;http://localhost/home/path/to/my/app/bin/css/poop/poop.cssandquot;/'` |
# |
Oct 9th 2016, 15:04 |
ndm |
pass the value to debug in `h()` for future debugging... |
# |
Oct 9th 2016, 15:03 |
ndm |
ok... hence the non-encoded HTML debug output... |
# |
Oct 9th 2016, 15:03 |
waspinator |
I'm trying to create pdfs from a shell |
# |
Oct 9th 2016, 15:03 |
waspinator |
yes |
# |
Oct 9th 2016, 15:02 |
ndm |
Are you on the shell by any chance? |
# |
Oct 9th 2016, 15:00 |
waspinator |
not sure. this is what I'm calling exactly: ` ?php debug($this->Html->css('poop/poop', ['fullBase' => true, 'once' => false])); debug($this->Html->image("logo.png", ['fullBase' => true])); debug('hello'); ? ` |
# |
Oct 9th 2016, 14:59 |
ndm |
Your debug problem is that you're explicitly outputting it as "don't handle it as HTML", ie not entity encoded, hence the output is being interpreted as actual HTML, ie you must be doing someting like `debug($foo, false)` |
# |
Oct 9th 2016, 14:59 |
waspinator |
and it gives the file system path in the url ... which wouldn't work either . hmm |
# |
Oct 9th 2016, 14:58 |
waspinator |
although now that I'm looking at it it seems to be pointing to the wrong place. `bin/img` instead of to `webroot/img` |
# |
Oct 9th 2016, 14:57 |
waspinator |
` ########## DEBUG ########## 'img src="http://localhost/home/path/to/my/app/bin/img/logo.png" alt=""/' ########################### ` and a `########## DEBUG ########## ' ' ###########################` in th pdf |
# |
Oct 9th 2016, 14:54 |
ndm |
Like `pre class="cake-debug">and#039;<img src=andquot;http://host/img/logo.pngandquot; alt=andquot;andquot;/>and#039;</pre`... and in the PDF it's just an empty string? |
# |
Oct 9th 2016, 14:54 |
waspinator |
same result for both WK and Mpdf |
# |
Oct 9th 2016, 14:54 |
waspinator |
yes |
# |
Oct 9th 2016, 14:53 |
ndm |
@waspinator So when you look at `html()`, the generated debug output contains the expected HTML entity encoded image/link tag? |
# |
Oct 9th 2016, 14:51 |
waspinator |
samyak, look at http://book.cakephp.org/3.0/en/development/routing.html |
# |
Oct 9th 2016, 14:39 |
waspinator |
@ndm hmm, tried using Mpdf and got the same results. just empty strings. |
# |
Oct 9th 2016, 14:39 |
samyak |
can you let me know how I can remove the "pages" from the URL, please |
# |
Oct 9th 2016, 14:38 |
samyak |
HI everyone |
# |
Oct 9th 2016, 14:37 |
samyak |
HI guys, I am building a simple CMS based on Cakephp, with categorized "posts" as in Wordpress. I can handle the admin sections where admin users will add/edit these pages. However can you guys give me directions to how to route these pages in the frontend? Ideally I dont want the pages to have "pages" in the URL and also be able to add the category slugs in the URL. something like, http://www.example.com/cakes/fruit_cake_recipe |
# |
Oct 9th 2016, 14:08 |
ndm |
Possible... try a different engine to verify |
# |
Oct 9th 2016, 14:06 |
waspinator |
and running `debug($CakePdf->html())` after `->write()` shows the correctly generated links. so it's a WKHTMLTOPDF thing? |
# |
Oct 9th 2016, 14:03 |
waspinator |
same issue with images though. `debug($this->Html->image("logo.png", ['fullBase' => true]));` is an empty string in the pdf. |
# |
Oct 9th 2016, 14:02 |
ndm |
Sounds weird... the only other circumstances I could see this happening, is when the corresponding `css` string template would be empty, or when the `block` option would magically turn to non-`null` |
# |
Oct 9th 2016, 13:59 |
waspinator |
and `debug('hello');` outputs 'hello', so it appears that `debug` is working |
# |
Oct 9th 2016, 13:58 |
waspinator |
no, still a empty string. If I call the same functions in a regular view I get the expected output. |
# |
Oct 9th 2016, 13:56 |
ndm |
@waspinator Try `'once' => false` to check whether that's the cause |
# |
Oct 9th 2016, 13:53 |
ndm |
That may be the case when the same file has already been included before... that should only apply per view instance I'd think |
# |
Oct 9th 2016, 13:51 |
waspinator |
hmm, it looks like I can call the `Html` helper, but trying to get a link to a css file just returns an empty string. `debug($this->Html->css('bootstrap/bootstrap', ['fullBase' => true]));` |
# |
Oct 9th 2016, 13:51 |
ndm |
* @maikh |
# |
Oct 9th 2016, 13:48 |
ndm |
AFAIR Dompdf loads CSS files via `file_get_contents` |
# |
Oct 9th 2016, 13:47 |
ndm |
@maik Is it possible that you have `allow_url_fopen` disabled? |