0

i created a field called : (sitename_ar) and i have two rows (two domains) in {domain} field :

enter image description here

and i have in my database these two fields {node} and {domain_access} :

enter image description here

enter image description here

and i want display in view page:

node : Title

node : Domain (sitename_ar)

i have created a view and i added a Title field and a Global:php field to call rows from database :

enter image description here

and i addedd those lines :

enter image description here

but always it display the same field (the first row) :

enter image description here

How i can Join all those 3 fields and display for each node her domain (with sitename_ar)

0

The error is in your php snippet. You request all rows, but $query->fetchObject(); only returns the first one, as you do not iterate over them. Use something like $query->fetchAll() or $query->fetchAllAssoc('domain_id'); instead to access all rows.

But, I think there must be smarter ways to handle this. Can't you add a relationship from the node to the domain? (I never used domain before). Such relationship would give you the domain entity associated with the node, so you always have the right one.

  • i will try adding relationship of nid (node) to the domain – Salaktarus Apr 12 '16 at 12:49
  • I meant a relationship in Views (if it exists it should already be there in the advanced section), not like an entity reference or such! – Neograph734 Apr 12 '16 at 12:52
  • i have an other solution: adding a table in field node , but i dont konw how i can call domain table and put the "sitename_ar" value to node table – Salaktarus Apr 12 '16 at 13:05
  • You need to install the Domain Views module and look at drupal.stackexchange.com/questions/82568/… – Neograph734 Apr 12 '16 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.