Hi

i would to use this module but it wouldn't:

for print version : only node content is printed...no views content
for pdf version : nothing is print with this warning

    warning: include(sites/all/modules/print/includes/inc_ficheform_docs.php): failed to open stream: No such file or directory in /var/www/drupal6/sites/all/themes/Cyrano_ER/node/node-fiche_formation.tpl.php on line 25.
    warning: include(): Failed opening 'sites/all/modules/print/includes/inc_ficheform_docs.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/drupal6/sites/all/themes/Cyrano_ER/node/node-fiche_formation.tpl.php on line 25.
    warning: include(sites/all/modules/print/includes/inc_ficheform_deco.php): failed to open stream: No such file or directory in /var/www/drupal6/sites/all/themes/Cyrano_ER/node/node-fiche_formation.tpl.php on line 33.
    warning: include(): Failed opening 'sites/all/modules/print/includes/inc_ficheform_deco.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/drupal6/sites/all/themes/Cyrano_ER/node/node-fiche_formation.tpl.php on line 33.
    warning: include(sites/all/modules/print/includes/inc_region_col_G1.php): failed to open stream: No such file or directory in /var/www/drupal6/sites/all/themes/Cyrano_ER/node/node-fiche_formation.tpl.php on line 41.
    warning: include(): Failed opening 'sites/all/modules/print/includes/inc_region_col_G1.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/drupal6/sites/all/themes/Cyrano_ER/node/node-fiche_formation.tpl.php on line 41.
    warning: include(sites/all/themes/Cyrano_ER/includes/inc_ficheform_deco.php): failed to open stream: No such file or directory in /var/www/drupal6/sites/all/themes/Cyrano_ER/node/node-fiche_formation.tpl.php on line 33.
    warning: include(): Failed opening 'sites/all/themes/Cyrano_ER/includes/inc_ficheform_deco.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/drupal6/sites/all/themes/Cyrano_ER/node/node-fiche_formation.tpl.php on line 33.

what's wrong with views embed ?
thanks

Comments

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

Where are you using "includes/inc_ficheform_docs.php" that your custom templates try to include it during the print module rendering.. You probably have path problems in that include.

About the views content... How are you including it in the node?

jcnventura’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No further info in two weeks. Closing the issue.

aiphes’s picture

Status: Closed (cannot reproduce) » Active

this is the code of includes/inc_ficheform_docs.php to embedding views :


$viewname_ldj1 = 'Liste_docs_joints';
$view = views_get_view ($viewname_ldj1);
$viewdisplay = $view->set_display('block_1');
$args_ldj1 = $view->set_arguments(array($node->nid));
$emptyText = $view->display_handler->set_option('empty','<div class=""><p>Pas de contenu à afficher en ce moment.</p></div>');

//Exécution de le vue
$view->pre_execute();
$view->execute();

if ($view->result) {
  // S'il y a un resultat on récupère le titre (ajoute tag h3, et le contenu)
  $output = '<div id="bloc_docs_ficheform"><h3>'.$view->get_title().'</h3>' .$view->preview($viewdisplay, $args_ldj1).'</div>';
//Affiche la vue
print $output;
}
//sinon affiche texte vide
elseif (empty($view->result)) {
    //Formatage du texte vide,ajout du titre de la vue
     $outputEmpty = '<div id="bloc_docs_ficheform"><h3>'.$view->get_title().'</h3>'.$emptyText.'</div>';
     //drupal_set_message('$EmptyTextVue : '.$emptyTextVue,'status');
     //Affichage du texte vide
  print $outputEmpty;
}

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

This is not where I think the problem is.. How are you including this file in /var/www/drupal6/sites/all/themes/Cyrano_ER/node/node-fiche_formation.tpl.php ?

aiphes’s picture

by template suggestion file system , custom template.php file :

// permet template suggestions avec page-
function phptemplate_preprocess(&$vars, $hook)
{
  switch($hook)
  {
      case 'page' :
      if (arg(0) == 'node')
      {
        $vars['template_files'][]  = 'page-' . $vars['node']->type;
      }
      break;

  }
}
aiphes’s picture

jcnventura’s picture

How can the line above create an include for 'includes/inc_ficheform_docs.php' ?

aiphes’s picture

in the node.tpl:

              global $theme_path;
              include ($theme_path.'/includes/inc_ficheform_docs.php');
              
jcnventura’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks for finally answering the question I asked in #1, #4 and #7.

I think one of the reasons why you're not getting anything is that print is by design theme-agnostic, and will not initialize the $theme_path variable.. You can make sure in your node.tpl.php that the theme is initialized, by calling init_theme() directly.

In this case, your php file is not included because $theme_path is empty, so PHP tries to find it inside the print module directory, and of course it doesn't show anything..

Once you get this working, please test PDF again.. If that still fails, set this to active, and please tell me which PDF library you're using.

aiphes’s picture

Status: Fixed » Active

sorry for my misunderstanding..
how can i initialize $theme_path in my theme ? is this init_theme() can do that and where can i paste it in my theme ?

thanks

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

You can safely add init_theme() at the start of your node.tpl.php, or between the two lines you indicated in #8. That should make sure that $theme_path is set to the correct value.

aiphes’s picture

is it good like this ?

<!--______________NODE TPL POUR PAGE.TPL CUSTOM________________ -->
<?php init_theme(); //initialisation variable?>
<div class="node <?php print $classes;...
jcnventura’s picture

It should be.. With that, when using the print module, the $theme_path variable should have the correct value.

aiphes’s picture

how can i check if the variable take the good value ? firebug or php debug code like print(); ?

jcnventura’s picture

print it out just before doing the include.. When seeing it as a normal page, you should see the same value that you get when using the print module.

aiphes’s picture

Status: Postponed (maintainer needs more info) » Active

there is an issue with this code in node.tpl...
actually print version doesn't display view content...it works on page.tpl not overrided by node.tpl

include(sites/all/modules/print/includes/inc_region_footer_actu.php): failed to open stream: No such file or directory dans /var/www/drupal6/sites/all/themes/CyranoD6_BL/node/node-page_affiche_mois.tpl.php à la ligne 95.

for pdf version , seem not work at all...which pdf generator is better ? actually i try wkhtmltopdf-i386 in /sites/all/libraries for multisite install

jcnventura’s picture

Status: Active » Closed (cannot reproduce)

From the original post:

for print version : only node content is printed...no views content
for pdf version : nothing is print with this warning

and #16:

there is an issue with this code in node.tpl...
actually print version doesn't display view content...it works on page.tpl not overrided by node.tpl

I know that this doesn't work with the print version using your node.tpl.php, this is what we've been discussing for 17 posts now.. I've been trying to help you and me to understand what the root of the problem is.

As to the best pdf tool, it's wkhtmltopdf, and it should work the same as the print version, but it may be that your web server can't run it for some reason. Check the logs to see if that's the case.

I'm not sure I can continue to help you.. This seems to be an issue with your code, and you don't seem to be capable of debugging your code without my help.

aiphes’s picture

Status: Closed (cannot reproduce) » Active

ok i think i can fix this by replacing :

 /* inclusion d'une region pour bloc */
              global $theme_path;
              include ($theme_path.'/includes/inc_region_col_G1.php');
              

by

   include (drupal_get_path(theme,theme_name).'/includes/inc_region_col_G1.php');
              

but i need help about syntax...

aiphes’s picture

work for print version but not for pdf one...

       include (drupal_get_path('theme',theme_name).'/includes/inc_region_col_G1.php');
              
jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

What do you mean it does not work for PDF? How exactly does it not work?

Do you get any errors? See also /var/log/apache2/error.log, please.

aiphes’s picture

for pdf version the page is blank...nothing in /var/log/apache2

in watchdog :
wkhtmltopdf: Loading pages (1/5) [> ] 0% [======> ] 10% [=======> ] 12% QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "provence-formation.vmdev" [============================================================] 100% Resolving links (2/5) [============================================================] Page 1 of 1 Counting pages (3/5) [============================================================] Page 1 of 1 Printing pages (5/5) [> ] Preparing [===================> ] Page 1 of 3 [=======================================> ] Page 2 of 3 [============================================================] Page 3 of 3 Done

Printer, email and PDF versions - PDF generation library wkhtmltopdf 0.9.6

I think path issue is fixed no ?

jcnventura’s picture

I think so, but the PDF is empty because it can't connect to your vm.. Possibly to get images. I'd recommend that you configure your web server to allow access to itself. It seems at the moment that it can't connect to provence-formation.vmdev.

aiphes’s picture

Status: Postponed (maintainer needs more info) » Fixed

according to this : http://code.google.com/p/wkhtmltopdf/issues/detail?id=193&q=connecttohost

it's probably due to local server...on production one it works :)

thanks for your help

jcnventura’s picture

np.. Sorry for my lack of patience :) I'm glad you sorted out the problem.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.