Snippet: cwsoft-anynews

rumen

I did it with the old ver. Somehow I could make it with some formating, group picture (all posts will use one and the same, but ...) . It is not exactly as I wished, but it is ok!

Will look something like that:



Thanks for the help!

Gast

the code from dbs is part of the twig-version -> {{ news.GROUP_IMAGE }},  see the double brackets here. your version is older and use phplib. twig and phplib are "translators" for the placeholders and different methodes, not possible, to mix it. phplib use a single brackets like {} or [] around a placeholders. the most templates in the wb-backend using phplib, newer modules like new wrapper, mod_multilingual using twig
in attachement a older version of anynews, the latest before cwsoft stops this project here. is has twig as thirthparty onboard, so its possible to run in older wb-versions without twig in the package.
twig is now part of wb since SP4 (?)

in this version i use another parameter called start_item. thia parameter make it possible, to start the output somewher in the loop of the news. for example: a first standard function call show's the first 5 elements of the news, in a second call, i use the start_item-parameter with the value == 6, it means: show me the X next elements, but start at element number 6.

here some  examples code for the output, using in a project in different sections, first call run's in a slider and shows only special news for this slider

at first a standard call
show all item from group = 2, in display_mode = 4, order=descending, max lenght = 170 chars
[[getNewsItems?group_id=2&display_mode=4&max_news_items=999&sort_by=1&sort_order=1&max_news_length=170&allowed_tags=<p><a><img><strong>]]

after a wysiwyg section, a block with only 4 news in a teaser line
next a limit of 4
show only 4 news from group 1
[[getNewsItems?group_id=1&display_mode=5&max_news_items=4&sort_by=1&sort_order=1&start_item=0&not_older_than=999&max_news_length=150]]


after a grafic element, i need some more news in a second teaser block
the example with the start item
show maximal two news from group_id = 1, start with number 4
[[getNewsItems?group_id=1&display_mode=5&max_news_items=2&sort_by=1&sort_order=1&start_item=4&not_older_than=999&max_news_length=150]]

rumen

OK I upgraded to

CMS Version 2.8.3 SP7
Revision 1646
Admin version 1.6

But the p[roblem is the same and the code table is destroied shows all cyrrilic letters as ???????? but I will fix that ... in framework/calss.database under run quiry I need to add:

$set = @mysql_query ('SET NAMES utf8');
$set = @mysql_query ('SET COLLATION_CONNECTION=utf8_general_ci');


But will need to write again everything. Thanks God is not big deals, the text is small.

rumen

My PHP is 5.6 but it is on my localhost under XAMPP server. After I'm ready I will transfer the site to host where I can set PHP ver. to 7 if I want. WB I can upgrade to 2.8.3-SP7 - but do you think this will resolve the issue?

dbs

Your PHP version is 5.4 or lesser i think.
Nobody should work with these old and unsecure systems like yours.
I can't help. Maybe you think about upgrading WB and modules?
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

rumen

A well we have 2 codes, right? One is for use the module and the other is for htt template.

For use it:

displayNewsItems(
   $group_id = 0,
   $max_news_items = 6,
   $max_news_lenght = -1,
   $display_mode = 4,
   $lang_id = 'BG',
   $strip_tags = true,
   $allowed_tags = '<p><a><img>',
   $custom_placeholder = false,
   $sort_by = 1,
   $sort_order = 1,
   $not_older_than = 0
   );


Where I have to put custom placeholder the image I want .... and in the help file is given that example:

$custom_placeholder = array('IMG_LINK' => '%img%', 'MY_VAR' => '#(test)#i'

and we have htt template:

<div class="anynews">
<!-- BEGIN news_block -->
<div class="row">
<div class="col-1-3">
<div class="wrap-col">
<div class="item t-center">
<div class="item-container">
<tt></tt>{GROUP_IMAGE}<br />
</div>
<div class="item-info">

<hr />

<h3><tt></tt>{TITLE}<br /></h3>


<tt></tt>{CONTENT_SHORT}<br />
<tt></tt><p><a href="{LINK}">{TXT_READMORE}</a></p><br />
</div>
</div>
</div>
</div>



<!-- END news_block -->
</div>


Do you suggest to change {GROUP_IMAGE} with {{ news.GROUP_IMAGE }} in the htt file?

rumen

#221

dbs

How old is your anynews or wb?
In newest versions it looks like this
{{ news.GROUP_IMAGE }}
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

rumen

Most probably I'm doing a simple and stupid syntax error somewhere .... Can you give me an example how the syntax should be if I have picture in /media folder called "test.jpg" in this code:

$custom_placeholder = array('IMG_LINK' => '%img%', 'MY_VAR' => '#(test)#i'

rumen

It is very strange, but I don't see any iamge file there and the code should call the image.

<tt></tt>{GROUP_IMAGE}<br />

Maybe the code here is wrong.

rumen

Here is the HTML code

<div class="anynews">

<div class="row">
<div class="col-1-3">
<div class="wrap-col">
<div class="item t-center">
<div class="item-container">
<tt></tt><br>
</div>
<div class="item-info">

<hr>

<h3><tt></tt>Заглание на новина 2<br></h3>


<tt></tt><p>Тук ще сложим анонса на новина две, който също ще ни послужи, за да видим как стои на екрана.</p>
<br>
<tt></tt><p><a href="http://localhost/iwork/pages/posts/zaglanie-na-novina-2-4.php">read more</a></p><br>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-1-3">
<div class="wrap-col">
<div class="item t-center">
<div class="item-container">
<tt></tt><br>
</div>
<div class="item-info">

<hr>

<h3><tt></tt>Заглавие на новина <br></h3>


<tt></tt><p>Анонс на новина тук! Трябва да има текси, за да се вижда как изглежда анонса и т.н.</p>
<br>
<tt></tt><p><a href="http://localhost/iwork/pages/posts/zaglavie-na-novina-3.php">read more</a></p><br>
</div>
</div>
</div>
</div>
</div> <div class="row">
<div class="col-2-3">
<div class="wrap-col">
<div class="slider">
<!-- Content- Left HERE -->



<div class="clear"></div>
</div>
</div>
</div>
<div class="col-1-3">
<div class="wrap-col">
<!-- Content- Right HERE -->
</div>
</div>
</div>
</div>
</div>

Gast

what i mean, is the output in your frontend with the missing pictures

rumen

Pictures are uploaded in /media

And the code should call them from /media (as the news module see them and show them on the screen or not?).

This is the htt:

<div class="anynews">
<!-- BEGIN news_block -->
<div class="row">
<div class="col-1-3">
<div class="wrap-col">
<div class="item t-center">
<div class="item-container">
<tt></tt>{GROUP_IMAGE}<br />
</div>
<div class="item-info">

<hr />

<h3><tt></tt>{TITLE}<br /></h3>


<tt></tt>{CONTENT_SHORT}<br />
<tt></tt><p><a href="{LINK}">{TXT_READMORE}</a></p><br />
</div>
</div>
</div>
</div>



<!-- END news_block -->
</div>

Gast

please use a browser tool like firebug or key F12 to look into this elements, search there for the path to the image(s)
maybe its a path like this:

Quotesrc="{SYSVAR:MEDIA_REL}/you_image.jpg"

and not with the real domain adress

rumen

I couldn't call an image I saved in /media. In custom htt template I put {GROUP_IMAGE}, but the image doesn't appear. What I did wrong?

Second the iamge can be only one for all news as group image or I can put different image in the all news and call the image with tne news?

In the attached zip file "offers" there are files files "top_offers" - how it should be (the pictures are not yet there, but it is visible where they should appear). In the "test_offers" is my result at the moment.

Regards,

cwsoft

@gnom: you don't need to change the Flexslider CSS files. Just adapt cwsoft-anynews/css/flexslider-custom.css to fit your needs. This file is loaded after the original Flexslider CSS file and hence able to overwrite the defaults to your needs.

Cheers

gnom

hmm okay... found out now the css that makes it too "height" is in css thirdparty/flexslider ... don't want to change there something. So ... don't know what to do .. think will check it on weekend again .... or send you link.  if anyone has a "special" own template for anynews (htt-file) and the css for it - feel free to send it to me :-D thanks!

gnom

thanks will try in the eventing and hope it will work.


Gast

Quote from: gnom on January 31, 2016, 10:47:40 AM
can someone help me? I want to show only the last three news on start-site ... to use the droplet is no problem - but the display-mode and css :-(
want to use a slider like display-mode 4 - but it's too height - it doesn't look very nice :-(
change the width, I was able to do.. but how can I change that it's not that high as original template?

i use there the flexslider, but not sure, is this the original in the file display-mode4 or not

if yes and in my case: the flexslider builds a div around your selected news btw the content-short. this div use padding for the distance to the top, bottom, left and right
its defined in the file css/custom-settings-flexslider.css with
my example
div.newsslider1 .flexslider {
        padding:15px 15px 15px 70px;
        background: #DDEDED url(../images/news_bg.png) 10px 10px no-repeat;
}
.flexslider img {border: 2px solid #ffffff;}


newsslider is here a extra div, was better for me to configured. (so be carefull, if you use Copy&paste)
the paddings means: build a distance from the displayed text to the borders with 15px, and 70px from the left border ( i use there a small background-image)
its important, to have no fixed height for the slider, defined in the base settings of this flexslider-div, if you need a height, use min-height (its work's for shorter messages with only one line)
here my code div.mod_anynews1 .flexslider {
        max-width: 808px;
        min-height: 100px;
        background-color: #DDEDED;
        border: 1px solid #00808E;
        padding:0;
        margin:0;
        color:#000000;
}


i didnt use a definition for the max-height or height , i use there max-lenght in the droplet-call (in my case not longer then two line's - with these font on this page ~160 chars)

a good help is a plugin like firebug or webdeveloper-Toolbar to found the used settings for this box
flexslider use a basic-setting in flexslider.css in the thirdparty-folder
and a custom-settings.flexslider.css in the css-folder of this module
but its also possible to set all this in your template.css

if my post doesnt help, please post the URL to the "problem-"page here or via PM

gnom

can someone help me? I want to show only the last trhee news on start-site ... to use the droplet is no problem - but the display-mode and css :-(

want to use a slider like display-mode 4 - but it's too height - it doesn't look very nice :-(
change the width, I was able to do.. but how can I change that it's not that high as original template?


nibz

The problems now with the server are a good reason for my github project ;-).
I hope more people will join and make pull-requests to the github repo.
It's not my goal to replace the addons repo but in downtime we could at least get the latest module code :).

WebsiteBaker for the win!

Gast


nibz

Updated the repo: https://github.com/WebsiteBaker-modules/anynews

Changes:
+ Updated the readme links to the correct repo.
+ Updated the module info to link to the correct github repo
+ Updated the droplet: Added possibility to select the years to display
(thanks to marmot)

DarkViper

Quote from: J.R. on March 07, 2015, 08:10:39 PM
I apologize for sloppy writing and calling them "comparative arrays". What I meant to say was that the symbols "=>" or "=" or "==" or "===" are all array *operators* that check the state of a variable and that in PHP each can return slightly different results depending on the types of fields being checked and a few other cases.  As far as I can tell, "===" is considered the most accurate, but for most purposes "=>" works fine.

It's easy to misunderstand the syntay and meaning of =>
Normaly => is a simple 'equal or greater then' operator which compares values (==> compares values and data types).
Now a little confusion from PHP:
In case of defining an array => is a assignment operator without compare functionality.


Manuela
[url=http://www.youtube.com/watch?v=tmzDAz6ZvFQ]Der blaue Planet[/url] - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen[br]
[i]"You have to take the men as they are... but you can not leave them like that !" :-P [/i]
[i]Das tägliche Stoßgebet: [b]Oh Herr, wirf Hirn vom Himmel ![/b][/i]

J.R.

#203
Stefek,

I apologize for sloppy writing and calling them "comparative arrays". What I meant to say was that the symbols "=>" or "=" or "==" or "===" are all array *operators* that check the state of a variable and that in PHP each can return slightly different results depending on the types of fields being checked and a few other cases.  As far as I can tell, "===" is considered the most accurate, but for most purposes "=>" works fine.

I will be following the syntax protocol which you pointed out is the most common now that I understand it -- it's always good in coding to following the most widely used syntax when possible.

On the page you recommended I found out something else I did not realize about PHP, where it says:

"Comparing --
It is possible to compare arrays with the array_diff() function and with array operators."


I know my question has taken this thread a little off topic, so I will end by saying that prior to asking about the purpose of "=>" I had no idea there were so many different ways to say "equal to" in PHP, so this had been a very valuable discussion for me and I thank everyone who replied.  :-)

-- J.R.